Re: [ROOT] How to check for the root version while compile time

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed Dec 19 2001 - 14:01:56 MET


Hi Thomas,

   you can do something like:

#if ROOT_VERSION_CODE > ROOT_VERSION(3,1,5)
    // new code
#else
    // old code
#endif

See $ROOTSYS/include/RVersion.h. This file is included as soon
as you include any ROOT class header file.

Cheers, Fons.



Thomas Bretz wrote:

> Hi all,
> 
> many times now I had the following problem: I updated to a new root
> version and changed something old to something new. eg replaced
> gSystem->ProcessEvents by gClient->ProcessEventsFor. But there are still
> other people outside (10-20) which may still use an older root version.
> For some kind of overlapping time I would like to make it compile for
> both root versions by something like:
> #ifdef ROOT_VERSION > 30105
> ....
> #else
> ....
> #endif
> But such a feature is missing. I would really recommend to implement
> something like a -DROOT_VERSION=30105 in root-config which I can use in
> a statement like one above.
> 
> Best regards,
> Thomas.
> 
> 


-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:12 MET