This post describes building of boost library with Visual Studio 2013.
Other versions:
– Install boost 1.64 with VS2017
– Install Boost 1.62 with VS2015
– Install Boost 1.60 with VS2015
Building Boost have never been easier. Just double click this .bat-file and wait for it to be finished. Put this in a file called build_boost_1_58_vs2013.bat
and place it next to the boost_1_58_0
folder.
call "%VS120COMNTOOLS%..\..\VCvcvarsall.bat" x86 cd boost_1_58_0 call bootstrap.bat rem Most libraries can be static libs b2 -j8 toolset=msvc-12.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64 b2 -j8 toolset=msvc-12.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/win32 pause
The first line will add the Visual Studio tools to PATH
, in essence, you can just double click this file to build boost. For a Windows user, it can’t get much easier than this.
Then add stage/$(Platform)/lib
as additional library directory in project settings for all configuration types and for all platforms.
*
I have Visual Studio 2013 Express installed but I get the following when I run the batch file to build 32bit & 64bit Boost installations:
C:\Boost>call “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\….VCvcvarsall.bat
” x86
‘”C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\….VCvcvarsall.bat”‘ is not rec
ognized as an internal or external command,
operable program or batch file.
C:\Boost>cd C:\Boost\boost_1_58_0
C:\Boost\boost_1_58_0>call bootstrap.bat
Building Boost.Build engine
Failed to build Boost.Build engine.
Please consult bootstrap.log for furter diagnostics.
You can try to obtain a prebuilt binary from
http://sf.net/project/showfiles.php?group_id=7586&package_id=72941
Also, you can file an issue at http://svn.boost.org
Please attach bootstrap.log in that case.
‘b2’ is not recognized as an internal or external command,
operable program or batch file.
‘b2’ is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
I notice that on my machine vcvarsall.bat is in:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
rather than:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\….VC.
Any ideas on how to make the .bat file work? L
Thanks.
Hi Riskybiz,
The WordPress platform doesn’t really like backslashes. It likes to eat and strip them away.
The top line should be:
call “%VS120COMNTOOLS%..\..\VCvcvarsall.bat” x86
Hope this helps.
Thanks for the nice trick with the call to vcvarsall.bat via the VS120COMNTOOLS variable.
However I wonder if your script really builds any 64 but code, because you seem to use the x86 toolset. I believe you get only x86 code that way? Should you not use amd64 or x86_amd64 options to build x64 code?