Reputation: 9996
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.
Upvotes: 28
Views: 36794
Reputation: 80382
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
.
Upvotes: 39
Reputation: 23
In addition to above answers, I find BlueGo really helpful for building boost versions with MSVC 10/11/12. You can select different configurations and just select build, and it does the trick.
Upvotes: 0
Reputation: 100728
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.
Upvotes: 32
Reputation: 11
vs2012 ERROR: Cannot determine the location of the VS Common Tools folder.
vcvarsall.bat need call a "reg.exe" which in "C:\windows\system32\". if not in search path,will cause this error.
Add C:\windows\system32 to %PATH% will solved the problem.
Upvotes: 0
Reputation: 51
Check that your installation is correct by confirming the output of the following command:
C:\>echo %VS110COMNTOOLS%
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
Here's some simple instructions to follow to get rid of warnings when bootstrapping: http://landoftheninja.blogspot.com/2011/11/visual-c-11-and-boost.html
Don't miss his follow-up post that deals with the automatic linking.
Upvotes: 5