Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Build

Building the Boost.Threads Libraries
Testing the Boost.Threads Libraries

How you build the Boost.Threads libraries, and how you build your own applications that use those libraries, are some of the most frequently asked questions. Build processes are difficult to deal with in a portable manner. That's one reason why Boost.Threads makes use of Boost.Build. In general you should refer to the documentation for Boost.Build. This document will only supply you with some simple usage examples for how to use bjam to build and test Boost.Threads. In addition, this document will try to explain the build requirements so that users may create their own build processes (for instance, create an IDE specific project), both for building and testing Boost.Threads, as well as for building their own projects using Boost.Threads.

Building the Boost.Threads Libraries

To build the Boost.Threads libraries using Boost.Build, simply change to the directory boost_root/libs/thread/build and execute the command:

bjam -sTOOLS=toolset

This will create the debug and the release builds of the Boost.Threads library.

Note

Invoking the above command in boost_root will build all of the Boost distribution, including Boost.Threads.

The Jamfile supplied with Boost.Threads produces a dynamic link library named boost_thread{build-specific-tags}.{extension}, where the build-specific tags indicate the toolset used to build the library, whether it's a debug or release build, what version of Boost was used, etc.; and the extension is the appropriate extension for a dynamic link library for the platform for which Boost.Threads is being built. For instance, a debug library built for Win32 with VC++ 7.1 using Boost 1.31 would be named boost_thread-vc71-mt-gd-1_31.dll.

The source files that are used to create the Boost.Threads library are all of the *.cpp files found in boost_root/libs/thread/src. These need to be built with the compiler's and linker's multi-threading support enabled. If you want to create your own build solution you'll have to follow these same guidelines. One of the most frequently reported problems when trying to do this occurs from not enabling the compiler's and linker's support for multi-threading.

Testing the Boost.Threads Libraries

To test the Boost.Threads libraries using Boost.Build, simply change to the directory boost_root/libs/thread/test and execute the command:

bjam -sTOOLS=toolset test

Last revised: July 17, 2004 at 04:33:59 GMT

Copyright 2001-2003 William E. Kempf

PrevUpHomeNext