How to build Boost (I tried version 1.48.0) with Visual Studio C++ 11? bootstrap.bat
cannot find toolset vc11
. I added toolset vc11 to F:\Programming\boost_1_48_0\tools\build\v2\engine\build.bat
but got a message:
ERROR: Cannot determine the location of the VS Common Tools folder.
EDIT: The Ferruccio answer works for VS 2012 Express and Boost 1.51.0 too.
This answer works beautifully for:
VS2012
(Visual Studio 2012 Update 2) VS2015
(Visual Studio 2015 Update 2)In a nutshell
All Programs..Microsoft Visual Studio 2012..Visual Studio Tools..x64 Native Tools Command Prompt
.boost_1_53_0.zip
to C:\boost153
.bootstrap.bat
bjam.exe
(optional) Step-by-Step Instructions
All Programs..Microsoft Visual Studio 2012..Visual Studio Tools..x64 Native Tools Command Prompt
.cd c:\boost153
.bootstrap.bat
.bjam.exe
. This builds all of the libraries.When it has finished compiling after about 5 minutes, it states:
The Boost C++ Libraries were successfully built! The following directory should be added to compiler include paths: C:/boost153 The following directory should be added to linker library paths: C:\boost153\stage\lib
This is important, we will need to add these two paths to any new C++ project.
C:/boost153
to the compiler include path
and C:\boost153\stage\lib
to the linker library path
. Properties
, select Configuration Properties..VC++ Directories
. See the two portions of bolded text in the screenshot below): Let's run a simple program that shows off the power of boost, by adding support for foreach
loops:
// Source code below copied from: // http://www.boost.org/doc/libs/1_53_0/doc/html/foreach.html #include "stdafx.h" #include <string> #include <iostream> #include <conio.h> // Supports _getch() #include <boost/foreach.hpp> int main() { std::string hello( "Hello, world!" ); BOOST_FOREACH( char ch, hello ) { std::cout << ch; } _getch(); return 0; }
Result:
Hello, world!
Checked with Win10 x64
+ VS2015.2
+ Boost v1.6.0
.
I managed to get it to build by following these steps:
It does generate a lot of warnings about not being able to detect the toolkit version, but it proceeds anyway.
Update: I created GitHub repo called cclibs which makes it simpler to build Boost and some other C++ libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With