Dear Colleagues,
I have a trouble with reading a TTree containing objects of class ‘particle_event’, which is my own class. The piece of code I’m using to read it looks as following:
gROOT->ProcessLine(".L particle_event.cxx+");
particle_event *particle_events;
TFile *f = new TFile("threeRuns.el.root");
TTree *PicoTree = new TTree();
f->GetObject("PicoTree;1", PicoTree);
PicoTree->SetBranchAddress("particle_events",&particle_events); // <-- line producing linking error
// ....
The message from compiler is:
/tmp/ccJMDx7g.o: In function `int TTree::SetBranchAddress<particle_event>(char const*, particle_event**, TBranch**)':
/usr/cern/root/include/TTree.h:495: undefined reference to `typeinfo for particle_event'
/usr/cern/root/include/TTree.h:497: undefined reference to `typeinfo for particle_event'
collect2: ld returned 1 exit status
I’m using g++ 4.6.3 on Kubuntu 12.04. My makefile is shown below:
ALLSRC=selector.C Expr.cpp Logical.cpp Eq.cpp Lt.cpp Gt.cpp And.cpp Or.cpp Cut.cpp EventSelector.cpp
EXEC=selector
CXX=`root-config --cxx`
CXXFLAGS=`root-config --cflags`
LDFLAGS=`root-config --ldflags`
LDLIBS=`root-config --glibs`
$(EXEC): $(ALLSRC)
$(CXX) $(CXXFLAGS) -W -Wall -g -o $@ $^ $(LDLIBS)
clean:
rm -f $(EXEC) *.o
I must add that everything works fine if I’m using code produced by MakeSelector, the problem appears only when I want to compile “pure” C++ code.
Do you know what may be wrong here?
Kind regards,
Rafal