Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine the Boost version on a system?

Tags:

c++

version

boost

People also ask

Is C++ Boost still used?

After 20 years of active Boost development, it's now recognized as a very powerful C++ library, for each major version many C++ libraries from the community were added. The Boost reviewers have an advanced C++ skills and their contributions guarantee a high quality for many years.

What is Boost Linux?

Boost provides a set of free peer-reviewed portable C++ source libraries. It includes libraries for linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions and unit testing. This package is known to build and work properly using an LFS-10.1 platform.

Where is Boost installed Mac?

The headers should be in /usr/local/include/boost and the libs should be in /usr/local/lib.


Boost Informational Macros. You need: BOOST_VERSION


Include #include <boost/version.hpp>

std::cout << "Using Boost "     
          << BOOST_VERSION / 100000     << "."  // major version
          << BOOST_VERSION / 100 % 1000 << "."  // minor version
          << BOOST_VERSION % 100                // patch level
          << std::endl;

Possible output: Using Boost 1.75.0

Tested with Boost 1.51.0 to 1.63, 1.71.0, 1.76.0 and 1.77.0:


If you only need to know for your own information, just look in /usr/include/boost/version.hpp (Ubuntu 13.10) and read the information directly


#include <boost/version.hpp>
#include <iostream>
#include <iomanip>

int main()
{
    std::cout << "Boost version: " 
          << BOOST_VERSION / 100000
          << "."
          << BOOST_VERSION / 100 % 1000
          << "."
          << BOOST_VERSION % 100 
          << std::endl;
    return 0;
}

Update: the answer has been fixed.


Depending on how you have installed boost and what OS you are running you could also try the following:

dpkg -s libboost-dev | grep 'Version'

Boost installed on OS X using homebrew has desired version.hpp file in /usr/local/Cellar/boost/<version>/include/boost/version.hpp (note, that the version is already mentioned in path).

I guess the fastest way to determine version on any UNIX-like system will be to search for boost in /usr:

find /usr -name "boost"