How To Compile Boost Using g++ -std=c++11 From MinGW

To compile Boost using g++ -std=c++11 from MinGW, do the following:

  1. Ensure that MinGW is installed at C:\MinGW\
  2. Launch a regular Windows Command Prompt, not a MSys Command Prompt:

    cmd

  3. Ensure that the PATH Environment Variable contains C:\MinGW\bin\:

    set PATH=C:\MinGW\bin;%PATH%

  4. Change directories to Boost:

    cd C:\boost_1_54_0\

  5. Pass in mingw to bootstrap.bat:

    bootstrap.bat mingw

  6. Call b2.exe:

    b2.exe toolset=gcc cxxflags="-std=c++11" --build-type=complete stage

This will build Boost using the GCC toolset in MinGW with the g++ flags set to -std=c++11.

Note: This post was tested by compiling Boost 1.54.0 ( http://www.boost.org ) with GCC version 4.8.1 from MinGW ( http://www.mingw.org ).

The output from b2.exe using the flag cxxflags="-std=c++11" ended with:
...failed updating 156 targets...
...skipped 396 targets...
...updated 4783 targets...

Additionally, only 284 stage\lib files were built.

However, the output without using that flag ended with:
...failed updating 24 targets...
...skipped 40 targets...
...updated 5271 targets...

Additionally, 428 stage\lib files were built.

Therefore, not all stage\lib files are built using the flag cxxflags="-std=c++11".

Tagged on: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *