Well it should produce a main.o file. Anyways I don't think that cygwin GCC supports elf right out of the box. I think you will have to build a cross compiler.
Okay, I have it.. I have my build.bat, which calls bash with my shell script. My shell script cd's (in Cygwin format) to my where my .cpp files are it builds fine. I've also notice I don't need to add _ to my assembly labels anymore (I can just use "call main" instead of "call _main" and "extern ICanSeeThisFromC" instead of "extern _ICanSeeThisFromC").
copy the cygwin1.dll from <cygwin>/bin to windows directory and problem is gone. I have had the problem also several times. Another solution is to remove the cygwin1.dll from the windows directory. If it exists there.
MessiahAndrw wrote:I've switched from DJGPP to Cygwin (for ELF support without recompiling binutils)
The gcc that comes with cygwin produces pe-i386 object files. The binutils can understand various object types (including elf) as input, but can only target the i386pe emulation. You need a cross compiler to target elf from cygwin.
pcmattman wrote:A better idea is to have at the start of your batch script
Or just add it to your default windows path from system properties, environment variables. I think its under 'advanced system settings' if you're on vista. Works for me. [hint]You could even use a makefile instead of a batch file.[/hint]
jnc100 wrote:Or just add it to your default windows path from system properties, environment variables.
Once you start doing that for multiple compiler setups it starts getting dangerous. I used to do that for DJGPP and on my switch to Cygwin I kept calling the DJGPP binaries thanks to the PATH setup.
I think it is a good idea but for maximum portability (and relative ease of use) it's easier to do it via a batch/make file.