###  | # Boost.Threads ## Building and Testing

Introduction
First topic
Second topic
Footnotes

## Introduction

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 and 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.Thread libraries using Boost.Build, simply change to the directory boost_root/libs/thread/build and execute the command:

    bjam -sTOOLS=toolset

This will create four variants of the Boost.Threads library with the permuations of debug/release and runtime-link-dynamic/runtime-link-static. 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 static library named libboostthread. In addition, on Win32 platforms a boostthreadmon.dll and a coresponding import library are created. The source files that are used to create the libboostthread library are all of the *.cpp files found in boost_root/libs/thread/src, except for threadmon.cpp. These need to be built with the compiler's and linker's multi-threading support enabled. On Win32 platforms the boostthreadmon.dll is created from boost_root/libs/thread/src/threadmon.cpp. This, too, needs 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

## Footnotes

(1) {{text}}
(2) {{text}}

Revised 05 November, 2001

© Copyright {{author}} 2002. All Rights Reserved.