how to change order of system includes in mingw under cygwin?

0

I am trying to use mingw32 under cygwin32 to crosscompile. However, I get an error involving float.h

In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/winnt.h:16:0,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/minwindef.h:146,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/windef.h:8,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:69,
                 from globals.h:17,
                 from globals.c:10:
/usr/i686-w64-mingw32/sys-root/mingw/include/float.h:278:57: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant
 _CRTIMP double __cdecl __MINGW_NOTHROW _chgsign (double _X);

I found an article with a similar problem here:

https://www.cygwin.com/ml/cygwin/2003-07/msg00525.html

and they suggested changing the order of includes so that the mingw float.h is found before the gcc float.h.

However, if I attempt to include the header manually like so:

i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I /cygdrive/d/Cygwin32/usr/i686-w64-mingw32/sys-root/mingw/include

using the verbose option, then I get a message saying that my include was ignored because "is is a non-system directory that duplicates a system directory."

My guess is that by calling i686-w64-mingw32-gcc automatically includes that directory if i have installed the mingw libraries and source for cygwin, which I did.

In the compiler verbose output I can clearly see the problem in the order of the includes.

/usr/lib/gcc/i686-w64-mingw32/4.8.3/include
 /usr/lib/gcc/i686-w64-mingw32/4.8.3/include-fixed
 /usr/i686-w64-mingw32/sys-root/mingw/include

But how do I move the mingw include in front of the gcc includes?

James Joshua Street

Posted 2015-03-23T22:30:14.153

Reputation: 111

Answers

0

Figured it out you can use the gcc flag -nostdinc and then just redefine the include orders.

Not sure why my earlier google searches didn't find it.

James Joshua Street

Posted 2015-03-23T22:30:14.153

Reputation: 111