building boost libraries

boost is mostly header only library, there are a few libraries like file-system, threads, chrono that abstract the OS/Runtime Library concepts, and few have been implemented in cpp files regex for an example. These few libraries need to be built before you can use them.

boost comes with its own build engine, bjam, which is configured to build it with relevant dependencies and install the libraries in designated locations.

I am not getting into boost-bjam in this post, however I will cover building boost library using bjam with VS 2010 SP1.

Extract the latest boost version, at the time of writing this post the version happens to be 1.47, in some directory, may be f: boostboost_1.47, let’s call this a root directory. bjam is distributed as source along with boost, to build boost we need to build bjam first.

Open a VS 2010 SP1 Command Prompt, that would be VS 2010 Tools (either open x64 or 32), on that command prompt cd to root directory. Execute the command bootstrap.bat, this will build the bjam engine and place the bjam.exe in your root directory.


Once done building bjam, again on the same command prompt execute the command bjam and after a while you are all set. This command generates static libraries from boost code to be directly linked against you application.

Two lib files are generated for each library built, in case of chrono these are:

  • libboost_chrono-vc100-mt-1_47.lib ( this is release version)
  • libboost_chrono-vc100-mt-gd-1_47.lib ( this is debug version)

you will be required to provide these as input to linker, depending upon the release or debug version, to build and link