Hello ROOTers,
I have observed some unexpected behavior when doing a very simple test in Windows. I have built using MSVS 2010 and root-builder from the svn v5-28-00 tag. I compile a program in MSVS with all of the normal included libs (libCore, libHist, etc.) and everything works as expected in most situations. However, when I try to open a file containing TH2F’s and read one in using this code,
// includes not shown...
int _tmain(int argc, _TCHAR* argv[])
{
TFile *fin=new TFile("a.root","READ");
TH2F *h=0;
fin->GetObject("hist",h);
fin->Close();
}
I get the following errors:
Warning in <TClass::TClass>: no dictionary for class TH2F is available
Warning in <TClass::TClass>: no dictionary for class TH2 is available
Warning in <TClass::TClass>: no dictionary for class TH1 is available
Warning in <TClass::TClass>: no dictionary for class TAxis is available
and the program fails to get the histogram from the file.
If I modify the program slightly to instantiate a dummy TH2F object before I try to open the file,
int _tmain(int argc, _TCHAR* argv[])
{
TH2F *hDummy=new TH2F("dummy","dummy",10,0,10,10,0,10);
hDummy->SetDirectory(0);
TFile *fin=new TFile("a.root","READ");
TH2F *h=0;
fin->GetObject("hist",h);
fin->Close();
}
then everything works as expected.
Is this reproducible for others or localized to my setup? It’s not a huge problem since I can easily instantiate dummies, but I would rather not if there’s some trivial way to fix this.
Thanks in advance,
Dan