Since \"gcc -mno-cygwin\" does not work anymore, I was looking for a way to get a MinGW-targeted GCC running within my Cygwin environment. (Running a MSYS environment is not
As you already found, you can use gcc-3 with -mno-cygwin
. The other possibility is to install the 32-bit and/or 64-bit toolchains from the MinGW-w64 project, which have been packaged for Cygwin very recently and hence are available through setup.exe now. Don't be put off by the rather confusing executable names: i686-w64-mingw32-gcc
is the 32-bit compiler and x86_64-w64-mingw32-gcc
is the 64-bit one.
Cygwin homepage says that "Individual packages like bash, gcc, less, etc. are released independently of the DLL.".
Here you can find how to install gcc under cygwin, so you should also select gcc package during install not only gcc-mingw.
Further searches revealed that the MinGW-targeted cross-compiler is not ready yet, and that one has to either use GCC v3 with -mno-cygwin, or install a cross-compiler manually (see link above)...
After installing the MingW g++ package for Cygwin (mingw64-x86_64-gcc-g++
), I also struggled to figure out how to invoke it.
Thanks to this wiki, I found out the command was x86_64-w64-mingw32-g++
. Then I did alias g++='x86_64-w64-mingw32-g++'
and g++
started working as expected.