Identifying root version by code?

Hello,

I have a code that works fine in root 5.14, but I had to modify it a little bit in order to work in version 5.16.

Is there any way to identify the root version by code, so I can write a independent version macro?

Luciano

$ROOTSYS/base/inc/RVersion.h contains:

#define ROOT_RELEASE “5.17/05”
#define ROOT_RELEASE_DATE “Oct 16 2007”
#define ROOT_RELEASE_TIME “15:44:42”
#define ROOT_SVN_REVISION 20369
#define ROOT_SVN_BRANCH “trunk”
#define ROOT_VERSION_CODE 332037
#define ROOT_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ©)

Using ROOT_VERSION_CODE you can discriminate version in compile time.

It is nice, thanks,

But I use some compiled libraries.
So it would be nice recognize it as a compilation directive like #ifdef root_version.

Do you know if it is possible?

Luciano

That’s exactly what I told you: use ROOT_VERSION_CODE.
RVersion.h contains the example:

/*

  • These macros can be used in the following way:
  • #if ROOT_VERSION_CODE >= ROOT_VERSION(2,23,4)
  •   #include <newheader.h>
    
  • #else
  •   #include <oldheader.h>
    
  • #endif

*/