Boosting VAOS

This is a short step-by-step guide for getting the Boost libraries in Visual Studio and use it in VAOS. Notes by Kai with a few changes and additions by Daniel. And a minor change by Mike.

Building Boost is much simplified since version 1.34 of it, so please follow the 1.34 instructions. 1.33 instructions are kept for reference.

Note There is a new set of instructions for building Boost for VAOS and later here.

Note that building Boost is currently unnecessary if you intend to build VAOS with VC6 as the only part of VAOS that uses Boost is Kai's (optional) new message builder, and that requires parts of Boost that can't be built with the (rather old and non-standard) VC6 compiler. Notes on building Boost with VC6 are here, however, just in case we later decide to use part of Boost that does with VC6 in some non-optional part of VAOS.


  • Download the main Boost package from here
  • Download boost jam ( from the same location
  • Unpack
  • Move directory "boost_1_34_1" to a directory of your choice, if not already done in step above. We will build from it and it contains the documentation. I used "Q:\", so my boost build directory is "Q:\boost_1_34_1" (and I will use that for examples from here on).
  • Move the "bjam.exe" from unpacking boost jam to "boost-jam-3.1.16" either to your path or put it in the top of your build directory "Q:\boost_1_34_1"
  • Now we can build the Boost libraries with bjam

Building Boost

Boost 1.33.1

  • Open a command prompt in "Q:\boost_1_33_1" and start building
  • I used the following command lines:
  • VC6: bjam -sTOOLS=msvc -sMSVCROOT="I:\Program Files\Microsoft Visual Studio\VC98" --prefix=Q:\Boost --layout=system install
  • VS 2003: bjam -sTOOLS=vc-7_1 -sVC71_ROOT="I:\Microsoft\Microsoft Visual Studio .NET 2003\vc7" --prefix=Q:\Boost --layout=system install
  • VS 2005: bjam -sTOOLS=vc-8_0 -sVC80_ROOT="I:\Microsoft\Visual Studio 8\vc" --prefix=Q:\Boost --with-python-root=I:\Python24 --layout=system install
  • This should start building the libraries to "Q:\Boost\lib" and move the Boost headers to "Q:\Boost\include"
  • It can take a while, I didn't measure it
  • Once it's ready it will tell you about 4 skipped targets and such (VC6 will fail/skip many more)
  • A fully built Boost as per the VS 2003 command line has 642 MB

Be aware that even if your bjam command is slightly incorrect it will start building and may give you a success message that looks like success but isn't. Instead it will fail building the libraries and just move the includes to their destination. The failure warnings appear in the command window, but if your PC isn't really slow you will not be able to read them. And the "running" throughput of failed and successful building looks quite the same. If you think you see some "failed" warnings in the output, then interrupt with CTRL+C and look closer.

  • If you don't have Python installed, don't include it in the bjam command. If you have Python installed you might want to include it since it gives you Boost's much simplified support for C++/Python interoperability.
  • Make sure, that the VC**_ROOT path points to the VC sub directory beneath your VS installation and not to the main VS installation directory.
  • Do not build to the same directory as from where you build, e.g. do not use --prefix="Q:\boost_1_33_1".
  • "--layout=system" means that the libraries are built without version information and such. It was my feeling that this might cater better for our needs. I may be wrong, though. With "system" the libraries are named "libboost_regex-mt-sgd.lib" (and .dll) while you get something like "libboost_regex-vc71-mt-sgd-1_33_1.lib" (and .dll) with the standard layout. The sgd marks the debug version.
  • I wasn't able to build an application that uses a Boost dll instead of linking the code in the application, see newsgroup for details

Boost 1.34

These notes apply both to 1.34 and 1.34.1.

The process is much the same as for 1.33.x, but the Boost build has been simplified. VC_ROOT no longer needs to be specified and there is no longer any need to specify a Python path (nor is there apparently any provision for doing so, but the Python libraries do appear to be built if the Boost build process can find a Python system (e.g. because it is on the PATH)).

The build command (for VS2005) should be:

bjam --toolset=msvc-8.0 --prefix="Q:\Boost" --layout=system install

Using Boost in VS

  • First we have to make a tiny change to the Boost header that is reponsible for the linking.
  • Go to "Q:\Boost\include\boost\config\auto_link.hpp" and edit after about line 300 as follows
//#  pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
//#     pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
#  endif

  • If you don't do this the linker will try to link against various differing library names and fail
  • This is a result of "--layout=system" as the Boost auto-linker seems to somehow know about it, but still produces the wrong name
  • Add "Q:\Boost\include" resp. "Q:\Boost\lib" either to the main options for Visual Studio in Tools/Options (preferred) or to your project in the sections where you can add extra include resp. library paths.

Making use of Boost in VAOS

  • #pragma warning( disable:4103 ) disables the pack warnings
  • This is already in the .cpp file, so just for the record, this is what I use to add boost::regex and string handling – the code shown here is all together in the header file common/va_boost.h
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string_regex.hpp>
//#include <boost/regex.hpp>
//#include <boost/algorithm/string/regex.hpp>
//#include <boost/algorithm/string/replace.hpp>
  • The commented out libraries can be used if only some part of the main functionality is wanted (that's what I first used)
  • BOOST_AUTO_LINK_NOMANGLE tells the Boost auto_linker to stop inserting all that extra stuff in the filenames
  • BOOST_LIB_DIAGNOSTIC shows the filename we link to
  • BOOST_LIB_TOOLSET "" undefines the toolset name (I could just do this in auto_link.hpp as well)
  • Now building with Boost in VAOS should work
  • Static building adds about 100 KB to the release binary and 200 KB to the debug binary
devinfo/howtoboost.txt · Last modified: 01.02.2012 18:30 by daniel
Recent changes RSS feed Driven by DokuWiki