Boost is a set of libraries for the C++ programming language that provide support for tasks and structures such as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions, and unit testing. Steps to build Boost for x32/x64 VC++ compilers on Windows are as follows:
- Download Boost and extract it to PC (assume
C:\Libs\boost_1_47_0
). - Double click to run
bootstrap.bat
in Boost’s root folder, which will generatebjam.exe
(andb2.exe
…) in the same folder. - Run VC++.
VC++ > Tools > Visual Studio Command Prompt
.In the command window, first change working folder to
C:\Libs\boost_1_47_0
and type the following command (Note: it will take a long time to finish, which is depended on your system, 20min for me.):1
bjam --build-type=complete toolset=msvc-10.0 threading=multi link=static address-model=64
- Setup VC++. Two steps need to be done.
- Add
C:\Libs\boost_1_47_0
to project Include files. - Add
C:\Libs\boost_1_47_0\stage\lib
to project Library files.
- Add
Remarks:
The above step will build static Boost libraries for x64 VC++. Options can be modified in step 5 to build it for other versions’ VC++, see the following table for details.
Command | Options | Meaning |
---|---|---|
toolset | msvc-6.5 msvc-8.0 msvc-9.0 msvc-10.0 msvc-11.0 msvc-12.0 |
Visual Studio 6.0, Service Pack 5 Visual Studio 2005 Visual Studio 2008 Visual Studio 2010 Visual Studio 2012 Visual Studio 2013 |
link | static shared |
static libraries shared libraries |
address-model | 32 64 |
x32 VC++ compilers x64 VC++ compilers |