Patrice Lebrun wrote: > > Hello, > > I create a very simple class: > > class TCoord : public TObject { > public: > TCoord(); > Float_t& x() {return pos[0];}; > Float_t& y() {return pos[1];}; > Float_t& z() {return pos[2];}; > > ClassDef(TCoord,1) > > private: > > TArrayF pos; > > }; > > With this implementation: > > ClassImp(TCoord) > > //_______________________________________________________________________ > TCoord::TCoord() > { > ///////////////////////////////////////////////////////////////////////// > // Constructor > ///////////////////////////////////////////////////////////////////////// > pos.Set(3); > } > > But I get this link error: > > Linking ... > /bin/ld: Unsatisfied symbols: > TCoord::ShowMembers(TMemberInspector&,char*) (code) > Virtual table for class 'TCoord': first non-inline virtual function > in 'TCoord' is not defined. (1930) > > How may I solve this problem an why I get this error ? > do I need to derive TCoord from TOject ? Patrice, Your simple class should work! I create the 2 files below TCoord.h and TCoord.cxx. Then (on hpux, that's where you are working), I did: rootcint -f CoordCint.cxx -c TCoord.h CC +a1 +z -I$ROOTSYS/include -c CoordCint.cxx TCoord.cxx CC -b -g +a1 -z CoordCint.o TCoord.o -o patrice.so in Root: Root > gSystem->Load("patrice.so") Root > .class TCoord // this gives correctly the class description //----------------------file TCoord.h------------------------------ #ifndef ROOT_Coord #define ROOT_Coord #include <TObject.h> #include <TArrayF.h> class TCoord : public TObject { public: TCoord(); Float_t& x() {return pos[0];}; Float_t& y() {return pos[1];}; Float_t& z() {return pos[2];}; ClassDef(TCoord,1) private: TArrayF pos; }; #endif //----------------------file TCoord.cxx------------------------------ #include "TCoord.h" ClassImp(TCoord) //_______________________________________________________________________ TCoord::TCoord() { ///////////////////////////////////////////////////////////////////////// // Constructor ///////////////////////////////////////////////////////////////////////// pos.Set(3); } Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:31 MET