Search code examples
boostg++mingwcompiler-flags

Link Boost headers without -I flag ( MinGW Distro from nuwen.net )


I Have MinGW Distro with GCC comiler and Boost Libs (download from nuwen.net).

I need link some Boost headers. And GCC don't looking for headers in "C:\MinGW\include" folder. It looking for only in this folders:

g++ ./server.cpp -v -c 
#include "..." search starts here:
#include <...> search starts here:
 c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include/c++/8.1.0
 c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include/c++/8.1.0/x86_64-w64-mingw32
 c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include/c++/8.1.0/backward
 c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/8.1.0/include
 c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed
 c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include
End of search list.

In my makefile I have to do this

g++ -I "C:\MinGW\include" ./main.cpp

but I want do just this:

g++ ./main.cpp

Can I set some Windows 10 evironment variable for gcc or I need set gcc it-self or something like this? Or should I always wirte flag -I ?


Solution

  • I got it. I have to compile it in the command line, which is opened by the file C:\MinGW\open_distro_window.bat. As stated in the instructions, in the third paragraph on these site.