tags:

views:

119

answers:

2

Is there a quick way to determine the version of the Boost C++ libraries on a system?

+5  A: 

Boost Informational Macros. You need: BOOST_VERSION

AraK
If you want to figure it out manually (rather than in-code), the go to the include directory, and open up version.hpp. `BOOST_VERSION` takes a bit of deciphering, but `BOOST_LIB_VERSION` is pretty clear. The value of mine is currently `"1_42"`
T.E.D.
+2  A: 
#include <boost/version.hpp>
#include <iostream>
#include <iomanip>

int main()
{
    std::cout << "Boost version: " << std::hex
              << ((BOOST_VERSION >> 20) & 0xF)
              << "."
              << ((BOOST_VERSION >> 8) & 0xFFF)
              << "."
              << (BOOST_VERSION & 0xFF)
              << endl;
    return 0;
}
hkaiser
+1 Thanks for giving an example.
AraK
Why not just: `std::cout << "Boost version: " << BOOST_LIB_VERSION;`?
T.E.D.