Search code examples
gcccygwin

Can't output anything using cygwin 1.7 gcc under windows


I just installed cygwin 1.7, and wrote a simple Hello world in test.c

but when I complie, nothing happens, even no error messages

gcc-4 -o test.exe test.c

enter image description here

And there's nothing generated under my folder.

I have included C:\cygwin;C:\cygwin\bin in my PATH

Did I miss something?

EDIT:

for more information, I installed Qt4, tortoiseHg, and mingw before. Now I had removed mingw. but still got Qt4 and tortoiseHg, is this a problem?


Solution

  • Try doing this from the Cygwin Terminal, not cmd.exe:

    $ cd `cygpath -u "$USERPROFILE"`/Desktop/UT
    $ gcc -o foo foo.c
    $ ls -l foo
    -rwxr-xr-x+ 1 yourlogin None 19618 May 10 05:15 foo*
    

    If that works, there's some bogus remnant lying around.

    You'll find that the Cygwin experience is generally better running under Bash, in a MinTTY terminal anyway. cmd.exe doesn't understand Cygwinisms, and is a DOS throwback besides.

    Note that you don't need to say gcc-4 to get GCC 4.x. gcc is GCC 4.x on Cygwin, and has been for quite some time now.

    Also note that you don't need to include .exe in the GCC -o flag, because Cygwin GCC knows to add that already.