Developers: Learn a New Programming Language or App Development with Deitel LiveLessons Videos!
s
menu
menu
Login  |  Register  |  Media Kit  |  Press  |  Contact Us  |   Twitter Become a Deitel Fan on Facebook  
Custom Search



Boost Installation InstructionsMinimize

The Boost libraries can be used with minimal setup on many platforms and compilers. An installation guide available at www.boost.org/more/getting_started/index.html pro­vides setup instructions for many compilers and platforms. There is an installer available for those using Visual Studio 2003 or 2005. You can download them from www.boost-consulting.com/products/free. The installer automatically downloads and installs the prebuilt binaries and header files. For those using Unix, Linux, FreeBSD or MacOS—the source distribution includes configure scripts to ease the installation. Below we provide detailed instructions for building the Boost Libraries from source and configuring a project using Visual C++ 2005 Express Edition. The instructions are also helpful to those using other compilers or IDEs.

Download the Boost libraries from the Boost website (www.boost.org). Boost 1.34 is the cur­rent release at the time of this writing. Also download the Boost.Jam build system. It’s easiest to download the Boost.Jamprebuilt binaries, or you can build Boost.Jam from the source. To install Boost.Jam, extract the folder and copy the bjam.exe file to any folder accessible by the PATH environment variable on your system.

Before building the Boost libraries, you need to decide what compiler or IDE you’re going to use. We used Microsoft’s Visual C++ 2005 Express. A list of supported toolsets (i.e., your compiler or IDE) can be found in the installation guide. Before using Boost with Visual C++ 2005 Express, you must install Microsoft’s Platform SDK and configure the vsvars32.batfile to recognize the Platform SDK. [Note: This step is not required if you have a complete version of Visual Studio 2005 installed.] Carefully, follow the instructions atmsdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx to install the Platform SDK. [Note: This is a large download.] Then configure the vsvars32.bat file to recognize the Platform SDK. The vsvars32.bat file is located in the folder C:\Program Files\Microsoft Visual Studio 8\Common7\Tools. To edit the file, right click and select Edit. Add

C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin;

to the PATH variable just before %PATH%. Then add

C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include;

to the INCLUDE variable just before %INCLUDE%. Finally, add

C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;

to the LIB variable. If you didn’t install Visual C++ in the default directory (C:\Program Files\Microsoft Visual Studio 8\VC), you must create an environment variable called VC80_ROOTthat points to the folder containing Visual C++.

Once you’ve configured your toolset, you’re ready to build the Boost libraries. Extract theboost_1_34_0folder (or current release folder) onto your computer. Open a com­mand prompt or command shell—if you’re using Visual C++ 2005, open the Visual Studio 2005 Command Prompt. Change to the directory where you extracted the Boost libraries. Type the command bjam --toolset=msvc install (replace "msvc" with the toolset name for your C++ compiler—e.g., "gcc" for GNU C++). This command builds all the libraries and installs them to the default directory, typically C:\Boost on Windows or /usr/local/boost_1_34_0 on Linux. bjam automatically detects the version of Visual C++ or GNU C++ you are using. You can specify the version number for other compilers by adding -version number after the toolset name (e.g., msvc-8.0).

 

            To use the Boost libraries in your projects, you must tell your compiler where to find the library and header files. To do this on Windows with Visual C++ 2005, first create an empty project and add a .cpp file to it—this is required to complete the next step. Right click the project name and selectProperties. Under Configuration Properties select C/C++, thenGeneral. Add the Boost include directory, C:\Boost\include\boost-1_34, to the Additional Include Directories field. [Note: If you used the installer from Boost Consulting, the libraries will be installed toC:\Program Files\boost\boost_1_34_0 by default. You’ll need to adjust the directory paths accordingly.] Next, under Configuration Properties select Linker, thenGeneral, and add the Boost library directory, C:\Boost\lib, to the Additional Library Directories field. We created an environment variable pointing to the Boost installation (BOOST_HOME) and used it to set the include and library directories. In Visual C++ 2005 Express, the preceding directories are entered as $(BOOST_HOME)\include\boost-1_34 and $(BOOST_HOME)\lib. This way, the IDE can find the directories on your system.

 

            Depending on your compiler or IDE, some Boost libraries also require that you add the library file as an additional dependency to your project. Visual Studio and GCC both support autolinking and you don’t need to specify the library dependencies.

 

Print  
c

 

Discounts on SafariBooksOnline.com subscriptions

foot
Update :: August 21, 2017