boost Installation or Setup


Example

See Boost Getting Started.

Most of the Boost libraries are header-only, meaning that there's nothing you have to compile or link to.

Make sure you are getting the most recent version of Boost:

  1. Visit www.boost.org
  2. Look for the Current Release download. Currently, this links here. Shows where on the boost website you can download Boost
  3. Select the appropriate archive file for your operating system, and download.

Header-only libraries can then be used by simply including the respective header files.

A few Boost libraries require compilation:

  • Boost.Chrono
  • Boost.Context
  • Boost.Filesystem
  • Boost.GraphParallel
  • Boost.IOStreams
  • Boost.Locale
  • Boost.MPI
  • Boost.ProgramOptions
  • Boost.Python
  • Boost.Regex
  • Boost.Serialization
  • Boost.Signals
  • Boost.System
  • Boost.Thread
  • Boost.Timer
  • Boost.Wave

Also, the following libraries have components which must be compiled:

  • Boost.DateTime

  • Boost.Graph

  • Boost.Math

  • Boost.Random

  • Boost.Test

  • Boost.Exception

The source for Boost can be obtained through the download link on the site, which will re-direct to its SourceForge page for the latest version (1.61.0 as of July 2016). This can be unzipped (or un-tared, etc) to a directory (such as C:\local\boost_1_61_0). This directory can then be added to the include path for the software you are building. After this, you can include Boost headers in C++ files with #include <boost/header/path.hpp>.

The majority of the libraries in Boost are header-only. If you only need these then the above source distribution is all that is needed. However, if you need to use one of the libraries that requires a compiled binary to be built, you will need that as well.

On any system, the most reliable way to get the correct binaries is to build them yourself. These directions are somewhat different for Windows or Linux/Unix/POSIX.

On Windows with Visual Studio, an alternative to building the libraries yourself is to download pre-built libraries from Boost's SourceForge page (1.61.0 as of July 2016). On that page you can select an installer that will install a version for a specific Visual Studio build or the 7-zip file (boost_X_XX_X-bin-all-32-64.7z) that contains the binaries for all the supported Visual Studio versions. Either of these options includes the source/headers as well as the binaries, so there is no need to have downloaded the source distribution above. Once you have it, extract/install to a directory (such as C:\local\boost_1_61_0) and add that directory to your include path, then add the directory containing the binaries that correspond to your version of Visual Studio (e.g. C:\local\boost_1_61_0\lib32-msvc-12.0 for Visual Studio 2013 32-bit projects) to the library path.