How to compile BOOST under MS Visual Studio 2010

Fortunately, to compile BOOST under MS VC 2010 we need Visual Studio Command Prompt and five commands:

Navigate to BOOST directory, for example:

cd F:\Projects\Lib\boost_1_53_0

Build bjam that is used to build BOOST:


Build BOOST debug and release static libraries:

b2.exe --toolset=msvc-10.0 link=static runtime-link=static variant=debug stage
b2.exe --toolset=msvc-10.0 link=static runtime-link=static variant=release stage

After that BOOST lib files appears in stage\lib\ directory.

3 Responses to How to compile BOOST under MS Visual Studio 2010

  1. Vasiliy on September 23, 2013 at 7:52 PM:

    to build x64 libraries add the address-model=64 parameter. see

  2. superadmin on November 12, 2013 at 4:49 PM:

    to build all the DLLs I used the following command
    b2.exe –toolset=msvc-11.0 link=shared

  3. superadmin on June 2, 2014 at 12:29 PM:

    You can force Boost to use the DLLs by defining BOOST_ALL_DYN_LINK – either in your C++ preprocessor settings or by a #define in your stdafx.h pre-compiled header, e.g.:

    #define BOOST_ALL_DYN_LINK



    // BOOST_ALL_DYN_LINK: Forces all libraries that have separate source,
    // to be linked as dll’s rather than static libraries on Microsoft Windows
    // (this macro is used to turn on __declspec(dllimport) modifiers, so that
    // the compiler knows which symbols to look for in a dll rather than in a
    // static library). Note that there may be some libraries that can only
    // be statically linked (Boost.Test for example) and others which may only
    // be dynamically linked (Boost.Threads for example), in these cases this
    // macro has no effect.
    // #define BOOST_ALL_DYN_LINK

Leave a Reply

Your email address will not be published. Required fields are marked *