Re: [ROOT] Problem loading shared library

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Oct 10 2003 - 21:09:01 MEST


You forgot to implement the destructor in your cxx file.

Rene Brun

On Fri, 10 Oct 
2003, 0ndrej Chvala wrote:

> Dear rooters,
> 
> I have created a very basics class, which is even based on aa working 
> class by Michal Kreps, added it into our small root project, compiled 
> the library and when I want to use that library, I get the following error:
> 
> root [0] gSystem->Load("../lib/libmicro.so");
> dlopen error: 
> /afs/cern.ch/user/o/ondrejch/public/mixing/src/./../lib/libmicro.so: 
> undefined symbol: __vt_19TBigDSWriteParticle
> Load Error: Failed to load Dynamic link library 
> /afs/cern.ch/user/o/ondrejch/public/mixing/src/./../lib/libmicro.so
> *** Interpreter error recovered ***
> 
> also when I want to link it with another code, I get:
> 
> g++    -o /afs/cern.ch/user/o/ondrejch/public/dst_write/bin/dst_write 
> dst_write.o -L/afs/cern.ch/na49/library/pro/lib -ldb -ltrk -g 
> -L/afs/cern.ch/na49/library/local/ROOT/root/lib -lCore -lNew -lHist 
> -lCint -lMatrix  -lTree -lPhysics -lRint -lMatrix -lMinuit -lEG  
> -lGraf-lGraf3d -lGpad   -L/afs/cern.ch/na49/library/pro/DSPACK/lib 
> -ldspack /usr/local/lib/libshift.a  
> /afs/cern.ch/user/o/ondrejch/public/mixing/lib/libmicro.so 
> -L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -lg2c  
> -L/afs/cern.ch/sw/fortran/pgi/pgi324/linux86/lib/ -lpgftnrtl -lpgc 
> -L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -lg2c  -ldl -lm -lc -lnsl -lcrypt
> /afs/cern.ch/user/o/ondrejch/public/mixing/lib/libmicro.so: undefined 
> reference to `TBigDSWriteParticle::IsA(void) const'
> /afs/cern.ch/user/o/ondrejch/public/mixing/lib/libmicro.so: undefined 
> reference to `TBigDSWriteParticle type_info function'
> /afs/cern.ch/user/o/ondrejch/public/mixing/lib/libmicro.so: undefined 
> reference to `TBigDSWriteParticle virtual table'
> collect2: ld returned 1 exit status
> gmake[2]: *** 
> [/afs/cern.ch/user/o/ondrejch/public/dst_write/bin/dst_write] Error 1
> 
> We tried everything we could and we are still lost :( Thanks for any help
> 
> These is the sources of the simple class in question -->
> 
> TBigDSWriteParticle.h:
> #ifndef TBigDSWriteParticle_Header
>                                                                                                                                      
> 
> #define TBigDSWriteParticle_Header
>                                                                                                                                      
> 
> #include "TObject.h"
> #include "TObjArray.h"
>                                                                                                                                      
> 
> class TBigDSWriteParticle : public TObject
> {
>   private :
>     Float_t fPx;                        // Momenta in x direction in LAB
>     Float_t fPy;                        // Momenta in y direction in LAB
>     Float_t fPz;                        // Momenta in z direction in LAB
>                                                                                                                                      
> 
>   public :
>     TBigDSWriteParticle();
>     TBigDSWriteParticle(Float_t px,Float_t py, Float_t pz);
>     ~TBigDSWriteParticle();
>                                                                                                                                      
> 
>     void SetPx(Float_t px) {fPx=px;};                   // Set px
>     void SetPy(Float_t py) {fPy=py;};                   // Set py
>     void SetPz(Float_t pz) {fPz=pz;};                   // Set pz
>     Float_t GetPx() {return fPx;};                      // Returns px
>     Float_t GetPy() {return fPy;};                      // Returns py
>     Float_t GetPz() {return fPz;};                      // Returns pz
> 
>   ClassDef(TBigDSWriteParticle,1) // Event base class
>                                                                                                                                      
> 
> };
>                                                                                                                                      
> 
> #endif
> 
> TBigDSWriteParticle.cxx:
> #include "TObject.h"
> #include "TBigDSWriteParticle.h"
>                                                                                            
> 
> ClassImp(TBigDSWriteParticle)
>                                                                                                                                      
> 
> TBigDSWriteParticle::TBigDSWriteParticle()
> {
>   fPx=0;
>   fPy=0;
>   
> fPz=0;                                                                     
> }
>                                                                                                                                      
> 
> TBigDSWriteParticle::TBigDSWriteParticle(Float_t px,Float_t py, Float_t pz)
> {
>   fPx=px;
>   fPy=py;
>   fPz=pz;
> }
> 
> 
> thanks and greetings,
> 0ndrej CHvala, NA49
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET