Marco, Remove the ClassDef and ClassImp statements from your code. Simplify your link command with g++ -o Muone Muone.C `root-config --cflags --libs` The ClassDef/ClassImp declarations may be used if you want to generate a dictionary for your class (via rootcint) eg if you want to call your class Muone from the interpreter. Rene Brun On Fri, 5 Nov 2004, Marco Garbini wrote: > Dear rooters I have a problem; I'm trying to compile my first root > program; if I derive a class from a TObject I get the following result: > gcc Muone.C -Wno-deprecated -O -Wall -fPIC -pthread > -I/cern/root/include -L-L/cern/root/lib -lCore -lCint -lHist -lGraf > -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -pthread > -lm -ldl -rdynamic -L/cern/root/lib -lCore -lCint -lHist -lGraf > -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lGui > -pthread -lm -ldl -rdynamic -o Muone > tmp/ccwxZ1PI.o(.text+0x41): In function > `__static_initialization_and_destruction_0(int, int)': > : undefined reference to `ROOT::GenerateInitInstance(Muone const*)' > collect2: ld returned 1 exit status > make: *** [Muone] Error 1 > > The code is the following: > Muone.C > #include "Muone.h" > ClassImp(Muone); > int main() { > }; > > > Muone.h > #include "TObject.h" > > class Muone : public TObject { > public: > Muone() {}; > virtual ~Muone() {}; > > private: > Float_t Mene; //muon energy > ClassDef(Muone,0) //Eas Muone > }; > > Thanks for your help > Marco > >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET