2

Do C++ Poco libraries have any macro or constant in the source code returning the current version of the library?

Francesco Boi
  • 5,497
  • 8
  • 54
  • 83

1 Answers1

3

The Poco::Environment class has a static member function libraryVersion():

#include "Poco/Environment.h"
#include "Poco/Format.h"

// ... 

std::string version = Poco::format("%d.%d.%d",
    static_cast<int>(Poco::Environment::libraryVersion() >> 24),
    static_cast<int>((Poco::Environment::libraryVersion() >> 16) & 0xFF),
    static_cast<int>((Poco::Environment::libraryVersion() >> 8) & 0xFF));

The value is taken from the POCO_VERSION macro in Poco/Version.h:

// Version format is 0xAABBCCDD, where
//    - AA is the major version number,
//    - BB is the minor version number,
//    - CC is the patch version number, and
//    - DD is the pre-release designation/number.
//      The pre-release designation hex digits have a special meaning:
//      00: final/stable releases
//      Dx: development releases
//      Ax: alpha releases
//      Bx: beta releases
//
#define POCO_VERSION 0x01090000
Günter Obiltschnig
  • 1,481
  • 12
  • 13