Monday, February 25, 2008

how to build boost 1.34.1 with Visual Studio 2008 Express

These instructions are for building boost 1.34.1 with visual studio 2008 express edition from a cmd prompt.

To build boost you will need The Microsoft Windows SDK for Visual Studio 2008 . This is available as an option when installing Visual Studio 2008.

To run Visual C++ (vc++) from the command prompt you will need some msvc related environment variables. Msvc comes with a batch file that sets these environment variables. An easy way to use this batch file to copy the "Start/All Programs/Accessories/Command Prompt" short cut from the start menu to your desktop and then change the short cut target property to %SystemRoot%\system32\cmd.exe /K call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat". After doing this, this short cut should bring up a command environment ready to run vc++. All the command line work described in the remainder of this post should be done using a cmd window in which vcvarsall.bat has been run ( whether through the shortcut just described or by some other means ).

Download boost 1.34.1 from sourceforge.net and uncompress. I used the zip file here

The 1.34.1 code needs some changes to work with Visual Studio 2008. You can use this patch to make these changes.

Instructions for applying the patch are in the patch (a text file) itself.

After extracting and patching boost, build bjam (the boost build tool) from the cmd shell as follows:

cd boost_1_34_1\tools\jam\src
build.bat

This should build src\bin.nt\bjam.exe, the command that you will use to build the rest of boost. You may see a few errors which you can ignore as long as bjam.exe gets built.

After making these changes, go to the top level directory: boost_1_34_1 and run:
tools\jam\src\bin.ntx86\bjam.exe
and then:
tools\jam\src\bin.ntx86\bjam.exe install

This will build the boost libraries and install them in c:\Boost .

13 comments:

Ben said...

Thanks for posting this, it was very helpful. You saved me a bunch of time.

John said...

Thank you for your wonderful documentation for getting Boost and the QuantLib running user VS C++ Express 2008.

Unknown said...

Big thanks Dave!!

very useful (till there's a new boost release)

Александр said...

Thank you!

Unknown said...

Hi Dave

Many thanks for saving me a lot of time getting this to work.

Paul

Unknown said...

You did forget about building with '--build-type=complete' option becasue for example ASIO won't run

Sumodirjo said...

thanks dave for the tutorial

Leonard Lee said...

Thanks Dave!

It really give us a clear picture to setup Boost with Visual Studio.

Unknown said...
This comment has been removed by the author.
Unknown said...

Hey! Thank you for that useful post!

JoeP said...

The link to the patch no longer works -- is it still possible to get the file?

Thanks,
-Joe

Unknown said...

Hi,

I tried to get the patch, but the link still does not work. Can You please make the patch available again ?

Thank You much.
Brano

DaveProgramming said...

The site that was hosting the patch mentioned in this blog entry has been down for sometime now.

However, later versions of boost have not needed the patch so it should not matter.

- dave