As part of understanding TR1, for the first time I’ve decided to try with Boost in fact I heard this word quite long time ago. TR1 introduces 14 new components the fact is that 10 of them are inspired from the Implemented boost library. The boost founder members are also part of C++ Standard Committee . Boost Compilers are portable and possible to build using different type of compilers like GNU C++, Intel C++ compiler ofcourse Microsoft C++ compiler 6.0 to 2005 can be used to compile Boost Libraries under Windows.

Earlier my decision was to use CygWin environment in my machine and use GNU C++ compiler which has already providing some functionalities of TR1. But it was rather difficult for me. Anyway I left that idea and now I compiled boost under Windows using Visual C++ (2005) 8.0 compiler . Visual Studio 2003 and Visual C++ 2005 and also Visual C++ 6.0 working together without any problems in my machine.

My first try was with Visual C++ 2003 compiler because in the documentation (when I downloaded first) it was specified that bjam (will explain later) only till Visual C++ 2003 (7.1) compiler (I’m not sure I’m missed about Visual C++ 8.0) . The library had built and created as many folderd in the target folder but those folders neither contain any libraries nor DLL. I don’t what really happened. So my try with Visual C++ 7.1 end in tears.

Just after a week I searched the boost documentation regarding configuring with Visual C++ 2005. Yea! this time bjam suppports build with Visual C++ 8.0

So confused on reading all these?

Ok let me explain each and every one.

1. What’s Boost?

Boost is a free, peer reviewed library which is highly portable across different compilers and operating systems and purely based on Ansi C++ standard. Have a look at Boost.org to know more about Boost

2. What’s TR1?

TR1 is the proposed template library for the next version of C++ (C++ 0x). Also a new proposal named TR2 also exists there. There are 14 new components in the TR1, and 10 among them are inspired from Boost Library

3. What is bjam?

Boost.Jam (BJam)  is a build tool based on FTJam, which in turn is based on Perforce Jam. It contains significant improvements made to facilitate its use in the Boost Build System, but should be backward compatible with Perforce Jam ( just copied the sentences from Boost :) ). Check the boost documentation to know more about Boost Jam

4. How to setup Boost in your machine?

Ok I shall explain side side setup for prepaing boost using Visual C++ compiler

1. Download latest version of Boost from Boost.org. The Boost Project is hosted at by Sourceforge.net. Choose Download Boost from Pckages menu

2. Since we are setting up using Visual Studio under windows, download boost package (e.g Boost_1_33_1.exe) for windows.

3. Extract the downloaded .exe (or zip) file to permanant place. e.g C:\Program Files\Boost_1_33_1 )

4. Now you have to build the bjam (build tool for Boost) to get bjam executable. You can also download the Pre-Built bjam files from Sourceforge.net. Before building bjam, take a look at the follownig priliminary setup

a. I compiled using Visual C++ 8.0 compiler (Shipped with Visual Studio 2005). You can also use Visual C++ 6.0, Visual C++ 7.1

b. Before you starting there are some priilminary steps for easy building. Go to the vc\bin folder of Visual Studio Installation directory (e.g c:\Program Files\Microsoft Visual Studio 8) .

c.Execute the vcvars32.bat in the bin folder to setup the environment variables and other options for the compiler. This is really important if you are installed different Visual C++ compilers in your system. You should make sure that you are setting up the environment for the desired compiler.

d. You can check the compiler version by taking Run->cmd.exe (cmd) and hitting enter key after typing cl ( or cl.exe)

e. It will show the version of Microsoft C++ compiler.

f. I could not setup the proper compiler for use even after setting up the vcvars32.bat of my desired compiler. You can manually modify the location of the compiler in the envirnment variables of the system. Edit the Path value of System Variable (you can also add a new variable) from the environment variables. Add the bin folder of you visual studio (don’t forget to remove if the bin folder of previous version or other version of compiler existing in the path varible. You can seperate the variables using ‘;‘. Now the system will locate the proper CL.exe after evaluating this environment variable. repeat step 4.D after closing the console window or takign a new window (the environment variables will be read on initializing the application so the newly added or modified variable may not be updated). To add envirnment variables Open My computer Properties->Advanced Tab->Environment Varibales

g. You may face error with Visual C++ 8.0 by could not locating mspdb80.dll to start cl.exe. You will not face any error if you are compiling normal project from Visual Studio IDE. Why it’s not showing error at that time? Some people through some forums suggest that download the missing DLL from dll-files.com and copy to the system32 folder. Don’t do that. The required dll will be there inside the (VS_ROOT)\Common\IDE (e.g. D:\Program Files\Microsoft Visual Studio 8\Common7\IDE) folder. You can locate the mpssb80.dll inside the specified folder. If it is not existing there it’s sure that theres’ some problem with your installation. So if you face an error because of missing mspdb80.dll, please add the IDE directory to the Path of system environment variables.

h. Sometimes you may also need to add the Include path of (either of platform SDK or Visual C++ default include) to the Path variable. e.g “C:\Program Files\Microsoft Visual Studio 8\VC\include”

5. Now you completed setting up the compiler and environment. It’s turn to build the jam source. You can locate the jam source at (Your_Boost_Root_Dir)\Tools\build\jam_src folder e.g (D:\Program Files\boost_1_33_1\tools\build\jam_src). A build.bat file will be there to build the jam source. If the visual studio 8 not existing in your build.bat file or in other words batch file is not able to take vc8 as parameter, please modify :Guess_Toolset section and :Setup_Toolset in the build.bat file. Visual C++ 7.0 Configuration will be there so you can simply copy paste and modify for Visual C++ 8.0, Just spend sometime in the batch file or download the pre-built file. :Guess_Toolset section will acn for the environment different Visual Studio Environment Variables (reverse choronological order). So it will compile with the latest version of the Visual C++ Compiler available in your system. Just give build.bat if you configured your compiler properly. See Boost Documentation for more info

6. Now you can build the libraries. the Bjam compilation will will create bin.ntx86 inside the jam_src folder. You can see the finally built bjam.exe

7. For the easy use, copy it to the boost root directory

8. You can build the boost source using following command.

For debug build:- bjam “-sBUILD=debug <runtime-link>dynamic <threading>multi” “-sTOOLS=vc-8_0″

For debug build:- bjam “-sBUILD=release <runtime-link>dynamic <threading>multi” “-sTOOLS=vc-8_0″

The -sTOOLS value also can be configured any of the following msvc, vc-7_1

Have a look at this link to know more about supported toolsets. Check about building boost under Visual C++ 8

9. The build process will create bin folder in the Boost Root directory. Each of the boost libraries will be built under seperate folder. You can do a search and put these things inside a folder for use.

I explained about the basic build processing of boost which worked out for me. Please let me know if you have some specific comments.