Compilation error while using TFile

Hy everybody.

I’ve got some troubles getting TFile to work in my CMSSW_1_3_1_HLT6 environment. I keep getting the following error at compilation:

/opt/sbg/cms/ui2-data1/jspeck/CMSSW_1_3_1_HLT6/tmp/slc3_ia32_gcc323/src/HLTefficiency/HLTefficiency/src/HLTefficiencyHLTefficiency/ undefined reference to `TStorage::ObjectAlloc(unsigned)' /opt/sbg/cms/ui2-data1/jspeck/CMSSW_1_3_1_HLT6/tmp/slc3_ia32_gcc323/src/HLTefficiency/HLTefficiency/src/HLTefficiencyHLTefficiency/ undefined reference to `TObject::operator delete(void*)' /opt/sbg/cms/ui2-data1/jspeck/CMSSW_1_3_1_HLT6/tmp/slc3_ia32_gcc323/src/HLTefficiency/HLTefficiency/src/HLTefficiencyHLTefficiency/ undefined reference to `TFile::TFile[in-charge](char const*, char const*, char const*, int)'

The code I use is like
i) In the class declaration, I have an

ii) and in the constructor

I have already tried several other things like using a myFile = new TFile("myFile.root","recreate);
but I keep getting the same error.

I have the following includes

#include <TROOT.h> #include <TFile.h> #include <TH1F.h>
Am I missing something at sourcing? Any idea?

Thanks in advance,

Unfortunately you do not mention which version of ROOT you use.
My guess is that you use a version of ROOT >5.14 where the I/O classes have been moved from libCore to libRIO. In this case you should add -lRIO to your link sequence.
To see the list of libs required do
root-config --libs
or better instead of specifying a long list of libs use the string generetad by root-config, ie
root-config --libs