Thursday, March 1, 2018

C++ with Mac: Install Boost Libraries

To install the Boost C++ libraries on a Mac

1. Download the latest Boost package, e.g. the boost_1_66_0.tar.bz2 file.

2. In terminal, move the the directory with the downloaded file and type:

tar --bzip2 -xf boost_1_66_0.tar.bz2

3. There are three types of Boost libraries:

(1) Header-only libraries. Just include these files without compilation. Most files belong to this type.
(2) Libraries required to be built. e.g. Boost.System, Boost.Thread, and Boost.Timer.
(3) Optional separately-compiled binaries, e.g. Boost Math, and Boost Random.

4. Follow the instructions in section 5.1 "Easy Build and Install" of Boost's getting started guide for unix-variants.

5. Follow the instructions in section 6 "Link Your Program to a Boost Library" of Boost's getting started guide for unix-variants. The main way A to link libraries may be like this command:

c++ -I ~your_path/boost_1_66_0/ test.cpp -o test ~your_path/boost_1_66_0/stage/lib/libboost_regex.a

Follow instructions in section 6.2. The result should be like this:



References

Boost libraries (boost.org)
Install boost on Mac OSX
Getting Started on Unix VariantsGetting Started on Unix Variants

No comments:

Post a Comment