1

How can I print the version of libssl and libnspr in c++ code ? I want to print version for both defined in header and library .

Vivek Goel
  • 22,942
  • 29
  • 114
  • 186

1 Answers1

1

The header file opensslv.h #define 's the macro variable OPENSSL_VERSION_TEXT, describing the version. For instance "OpenSSL 0.9.8o-fips 01 Jun 2010".

For the library itself, the name of the lib file contains the version number. In ubuntu, in the folder /lib/, the file is called libssl.so.0.9.8. If you felt like it, you could use boost::filesystem to grab the particular filename and then parse it, perhaps using boost::regex.

loki11
  • 374
  • 1
  • 4
  • I want to print ssl version on compile time to check with which version it is getting linked. – Vivek Goel Sep 24 '11 at 08:13
  • In Linux you must install the package openssl-devel: `apt-get install openssl-devel` or `yum install openssl-devel`. – JPaget Oct 17 '14 at 23:09