How To Compile Boost Using g++ -std=c++11 From MinGW
To compile Boost using g++ -std=c++11
from MinGW, do the following:
- Ensure that MinGW is installed at
C:\MinGW\
- Launch a regular Windows Command Prompt, not a MSys Command Prompt:
cmd
- Ensure that the
PATH
Environment Variable containsC:\MinGW\bin\
:
set PATH=C:\MinGW\bin;%PATH%
- Change directories to Boost:
cd C:\boost_1_54_0\
- Pass in
mingw
tobootstrap.bat
:
bootstrap.bat mingw
- 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"
.
- C++ Compiler Updates – September 2013
- Two-Dimensional Givens Rotation
Dear Joshua Burkholder, I am compiling a preflate compressor here in windows that is for a compressor job that I am carrying, the truth is that I had to change std :: threads for boost :: threads and that means I need the compilation of the boost .
well first it was the job of generating the b2.exe, I had to make changes in build.bat of the tools \ build \ src \ engine directory and then I did what you propose there, with boost_1.72 for windows.
and from there take this libboost_thread-mgw 63-mt-d-x32-1_72.dll linked with -lboost_thread-mgw63-mt-d-x32-1_72, and it worked.
Thanks a lot of luck.