Boosting your C++ tools

Here at the university surprisingly few people know about Boost, one of the probably most useful C++ libraries ever written (actually, it's a collection of libraries). If you never used it, give it a try. And if you're to lazy to read the "Getting started" document or you want a really brief start document, read on. (Or if Boost.Build refuses to build after you installed the latest DirectX SDK) This is a very brief guide how to get Boost running as fast as possible. I assume you have at least the following:

  • Windows XP
  • Visual Studio .NET 2003 (maybe 6.0 & 7.0 too)
  • Basic knowledge of Windows :)
  • Python in case you want to build the complete Boost library (this is what I describe here)

I also recommend you to get the "Command Here" Powertoy, it allows you to open a command line by right-clicking on a folder and selecting "Open command window here" which will be very handy :)


First of all you need to obtain Boost of course. In case you're not sure what to take choose the Windows Exe (the current version is: boost_1_33_0.exe), it's a sfx 7zip archive. Extract it to a drive where you have at least 3Gb of free space (I suppose you want to build all of it). Don't laugh, Boost takes quite a lot of space, the compiled binaries including all header files (compiled with 7.1, all in all around 3.5k files) take up 1,23 GB (1.323.074.806 Bytes) on my computer. You need to build Boost.Build first, which will compile the rest of Boost for you. Boost.Build is a modified version of the Jam build tool. Hence, you'll find it under /tools/build/jam_src. There it is, build.bat. For some reasons this build script does not work on my computer anymore (it used to work last month) - just after I installed the DirectX 9.0 SDK (October). The problem lies in the PATH environment variable. The DirectX SDK Installer added (in my case) F:\Visual Studio .NET 2003\Documentation\DirectX 9 SDK (October 2005)\Utilities\Bin\x86 - the braces around October caused the build script to fail. In such cases you can still get a precompiled binary (or you remove the DirectX SDK from Path). Copy the bin.ntx86\bjam.exe into the topmost directory of your Boost folder.


Now, you need to "install" Boost. When installing Boost, you have several choices, I recommend you to specify a "Temp" directory in which Boost will put the object files, and a "Install" directory where it will put in the *.lib, *.dll and *.h files. Instead of talking about the options (you can read them for yourself) here my build_boost.bat which I use without modifications since Boost 1.3: bjam "--prefix=F:\C++\Boost" "--builddir=F:\C++\Temp\Boost" "--with-python-root=C:\Python24" "-sPYTHON_VERSION=2.4" "-sVC71_ROOT=F:\Visual Studio .NET 2003\Vc7" "-sTOOLS=vc-7_1" install Replace --prefix with the directory that should contain the clean Boost binaries and headers, --builddir with the temporary directory, --python-root with your Python root (how surprising :)) and VC71_ROOT with the directory to Visual Studio 2003 (use VC7_ROOT for Visual Studio 7 and MSVC_ROOT in case you use 6.0). TOOLS will be vc-7_1 for 7.1, vc7 for 7.0 and msvc for 6.0. That should be enough to get you started, be patient, the compiling will take some time. Have fun with Boost! In case you have questions don't wait and comment :)


Comments powered by Disqus