Building Boost 1.58 with Visual Studio 2015

By , last updated October 25, 2019

If you try to build Boost 1.58 with Visual Studio 2015, you’ll get this error “Unknown compiler version - please run the configure tests and report the results” when building, do this.

There are different versions of Visual Studio so the changes should be applied accordingly.

Other versions:
Building boost 1.58 with Visual Studio 2013.
Build Boost 1.60 with Visual Studio 2015
Build Boost 1.62 with Visual Studio 2015

Visual Studio 2015 RTM

Open up boost_1_58_0\boost\config\compiler\visualc.hpp and go to lines 287-288. Replace those two lines with

// last known and checked version is 19.00.23026 (VC++ 2015):<br />
#if (_MSC_VER > 1800 && _MSC_FULL_VER > 190023026)

Batch file

Here is a .bat-file for building Boost 1.58 by just executing the batch file. Call it build_boost_1_58_vc2015.bat.

call "%VS140COMNTOOLS%../../VC/vcvarsall.bat" x86
cd boost_1_58_0
call bootstrap.bat
rem Most libraries can be static libs
b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64
b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/win32

rem Boost thread must be dynamic due to MFC
b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=shared threading=multi runtime-link=shared --with-thread --build-type=minimal stage --stagedir=stage/x64
b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=shared threading=multi runtime-link=shared --with-thread --build-type=minimal stage --stagedir=stage/win32

pause