I have installed ROOT v5.30.03 on Ubuntu 11.10. I am having trouble reading a TFile with compiled code; interactively it works fine. I’ve put a small example below that illustrates the problem.
To generate the test file:
{
TFile *f = new TFile("test.root", "recreate");
TH1F* h = new TH1F("h", "h", 100, 1, 100);
for (int i = 1; i < 101; ++i) h->Fill(i);
h->Write();
f->Close();
}
To read this file I use “tiny.C”:
#include "TROOT.h"
#include "TApplication.h"
#include "TSystem.h"
#include "TFile.h"
#include "TH1.h"
#include "TH1F.h"
#include "TAxis.h"
int main(int argc, char *argv[])
{
TApplication app("app", &argc, argv);
TFile *f = new TFile("test.root", "read");
return 0;
}
Which is then compiled using:
g++ `root-config --cflags` -c tiny.C -o tiny.o
g++ tiny.o `root-config --libs` -o tiny
When I run “tiny”, I get:
dlopen error: /usr/local/src/root-5.30.03/lib/libHist.so: undefined symbol: _ZTI14TVirtualFitter
Load Error: Failed to load Dynamic link library /usr/local/src/root-5.30.03/lib/libHist.so
Error in <TCint::AutoLoad>: failure loading library libHist.so for class TH1F
Warning in <TClass::TClass>: no dictionary for class TH1F is available
Warning in <TClass::TClass>: no dictionary for class TH1 is available
Warning in <TClass::TClass>: no dictionary for class TAxis is available
I have searched the forum and I am aware that this problem has occurred before, but I have tried all of the suggestions (e.g. adding TApplication) and none of them seem to work. The strange thing is this procedure works fine on SLC5 with ROOT v5.30.00. Where might I be going wrong? I have the same trouble on Ubuntu with version 5.28.00g. Any hints would be greatly appreciated.