Main navigation

How to use the Boost Libraries

The Boost header files are installed in /usr/include/boost and the libraries in /usr/lib.

To compile and link with Boost, add the Boost libraries you are using to the command as follows:

g++ pgm.cpp -lboost_whatever -o pgm

  • Replace pgm.cpp with the name of the file containing your source code.
  • Replace boost_whatever with the name of a Boost library you are using.
  • Replace pgm with the name of the executable to be created.

For example, to use boost_filesystem library code:

-lboost_filesystem

Report Typos and Errors
UCLA OIT

© 2016 UC REGENTS TERMS OF USE & PRIVACY POLICY