📅 2014-Jun-06 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ boost, visual studio ⬩ 📚 Archive
If your code compiled with Visual Studio needs Boost, you can get prebuilt Boost libraries. However, if your code needs to link with Boost library files, then the Visual Studio version used for your code and used to build Boost has to match. If you cannot find a prebuilt Boost library matching your Visual Studio then you might have to build Boost by yourself.
I had this problem since my code was using C++11 features that required Visual Studio 2015, but the prebuilt Boost libraries were only available for Visual Studio 2012.
To build Boost for Visual Studio, I followed these steps:
Download the source of Boost from here. Unzip it anywhere.
Open the Developer Command Prompt for Visual Studio. Change to the directory where Boost is unzipped.
Build the Boost.Build tool (b2.exe
) using this command:
> bootstrap.bat
> b2 toolset=msvc-14.0 --build-type=complete --abbreviate-paths architecture=x86 address-model=64 install -j4
toolset
: Use this to specify the Visual C++ compiler to use. For Visual Studio 2015, this is msvc-14.0
. For other versions of Visual Studio see this post.
architecture
: This is the processor architecture. Keep this x86
for both 32-bit and 64-bit builds!
address-model
: Use this to specify whether you want 32
or 64
bit library to be built.
-j
: Use this to specify how many cores to use for parallel compilation.
C:\Boost
.Note: Detailed steps to build Boost for Visual Studio can be found in this StackOverflow post.
Tried with: Boost 1.59, Visual Studio 2015 and Windows 7 x64