ROOT (cern) : gClient, gApplication

1.1k Views Asked by At

I have some problems using stuff like gClient->GetRoot() or gApplication->* in my programs. If I use root console (CINT), it's ok. But if I want to compile it I get :

'gClient' was not declared in this scope

Anyone knows an issue please ?

2

There are 2 best solutions below

0
On

You have to #include the correct include file, and depending on your setup, link some libraries.

If you search for root objects in the root help pages, the small box in the top right corner will tell you what you need.

0
On

gApplication is defined in TApplication.h, which is located in $ROOTSYS/include/TApplication.h. If you include this header file into your source code it should "just work." Similarly for other variables such as gROOT, gClient, etc - they are located in the header file TROOT.h, TClient.h, etc.

In my local version (ROOT v5.32 from 12/2011) the code snippet in the TApplication.h header file is

// definition of TApplication above
   ClassDef(TApplication,0)  //GUI application singleton
};

R__EXTERN TApplication *gApplication;

and the other ones look similar.