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:
  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 ( ) with GCC version 4.8.1 from MinGW ( ).

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".

One thought on “How To Compile Boost Using g++ -std=c++11 From MinGW

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="">