Friday, August 7, 2009

Configuring Boost C++ Library with Visual Studio 2008

I) Download Boost C++ Library

The latest release of Boost library is Version 1.39.0, released in may 2009. This release has the following new libraries and updates over its previous version, Version 1.38.0.

New Libraries : Signals2.

Updated Libraries : Asio, Flyweight, Foreach, Hash, Interprocess, Intrusive, Program.Options, Proto, PtrContainer, Range, Unordered, Xpressive. Updated Tools: Boostbook, Quickbook.

Download path: http://www.boost.org/

II) Integrating Boost C++ libraries with Visual studio 2008

Integration involves two steps. This makes the application utilize the facilities of Boost C++ libraries, and be fully functional.

1) ‘Including’ Boost directory path:-

Steps:-

a) Launch Visual studio 2008.

b) Click on ‘Tools’ menu & select ‘options…’

c) On the popped-up ‘options’ window, towards left, select and expand the directory ‘Projects and Solutions’. In the expanded list select ‘VC++ Directories’.

d) Now towards the right of ‘Options’ window, click on ‘Show directories for:’ dropdown list and select ‘Include files’.

e) Now in the window below, include the path of the Boost C++ ‘root’ directory. To do this, click just below the last included path. With this a cursor appears, where we can type the path, or we can even include the path by clicking on the ellipsis button at the end of the line and browse to the root directory.

f) Finally click on ‘Ok’.

2) ‘Linking’ the Boost libraries with the project.

Steps:-

a) In ‘Solution Explorer’, right click on the project folder and select properties.

b) Now the project properties window pops-up.

c) Towards the left of the properties window, select and expand ‘Configuration properties’ directory.

d) Now select and expand ‘Linker’ directory and click on ‘General’.

e) Now to the right of the ‘Project property’ window, select the property ‘Additional Library directories’ and add the path of Boost C++ Library directory.

(Example: ‘C:\Program Files\boost\boost_1_38\lib’).

f) Finally click ‘Apply’ and ‘Ok’.

III) ‘Build’ and ‘Run’ your application.

No comments: