Hi Nicolas, Your files TAstroNuc.h,cxx reference another class TNoyau that is missing in your list of files. In your case, it looks as if you have this class. If it is in a separate shared library (say libNoyau.so), you should link this shared lib before loading the libTastroNuc.so file. Rene Brun On Fri, 18 Apr 2003, Nicolas de Sereville wrote: > hi rooters, > > I'm tring to make a shared library of a class I wrote (see attachments). I make the 4 following steps without any > problems : > rootcint -f TAstroNucDict.cxx -c TAstroNuc.h TAstroNuc_LinkDef.h > g++ -fPIC -I/$ROOTSYS/include -o TAstroNucDict.o TAstroNucDict.cxx - c > g++ -fPIC -I/$ROOTSYS/include -o TAstroNuc.o TAstroNuc.cxx -c > g++ -o libTAstroNuc.so -shared TAstroNuc.o TAstroNucDict.o > > When I load the shared library in ROOT (3.05.03 CVS 14/04 on RH7.2), I obtain the following error : > root [0] .L libTAstroNuc.so > dlopen error: /home/astronuc/deserevi/root/macro/libTAstroNuc.so: undefined symbol: > ShowMembers__9TAstroNucR16TMemberInspectorPc > Load Error: Failed to load Dynamic link library /home/astronuc/deserevi/root/macro/libTAstroNuc.so > *** Interpreter error recovered *** > > > I also tried to build the shared library using ACLIC doing ".L TAstroNuc.cxx++" but I obtain the following error, > which is not the same that previously : > root [0] .L TAstroNuc.cxx++ > Info in <TUnixSystem::ACLiC>: creating shared library /home/astronuc/deserevi/root/macro/TAstroNuc_cxx.so > dlopen error: /home/astronuc/deserevi/root/macro/TAstroNuc_cxx.so: undefined symbol: __tf6TNoyau > Load Error: Failed to load Dynamic link library /home/astronuc/deserevi/root/macro/TAstroNuc_cxx.so > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start': > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main' > /home/astronuc/deserevi/root/macro/file505QEz.o: In function `TAstroNuc::TAstroNuc(void)': > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x4e): undefined reference to `TNoyau::TNoyau(void)' > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x99): undefined reference to `TNoyau::TNoyau(void)' > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0xe4): undefined reference to `TNoyau::TNoyau(void)' > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x12f): undefined reference to `TNoyau::TNoyau(void)' > /home/astronuc/deserevi/root/macro/file505QEz.o: In function `TAstroNuc::TAstroNuc(char *, char *, char *, char > *)': > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x305): undefined reference to `TNoyau::TNoyau(char *)' > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x353): undefined reference to `TNoyau::TNoyau(char *)' > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x3a1): undefined reference to `TNoyau::TNoyau(char *)' > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x3ef): undefined reference to `TNoyau::TNoyau(char *)' > /home/astronuc/deserevi/root/macro/file505QEz.o: In function `TAstroNuc::TAstroNuc(int, int, int, int, int, int, > int, int)': > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x5c8): undefined reference to `TNoyau::TNoyau(int, int)' > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x619): undefined reference to `TNoyau::TNoyau(int, int)' > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x66a): undefined reference to `TNoyau::TNoyau(int, int)' > /home/astronuc/deserevi/root/macro/file505QEz.o(.text+0x6bb): undefined reference to `TNoyau::TNoyau(int, int)' > /home/astronuc/deserevi/root/macro/file505QEz.o: In function `TBuffer & operator>><TNoyau>(TBuffer &, TNoyau > *&)': > /home/astronuc/deserevi/root/macro/file505QEz.o(.gnu.linkonce.t.__rs__H1Z6TNoyau_R7TBufferRPX01_R7TBuffer+0x1a): > undefined reference to `TNoyau type_info function' > /home/astronuc/deserevi/root/macro/file505QEz.o: In function `TBuffer & operator>><TResonnance>(TBuffer &, > TResonnance *&)': > /home/astronuc/deserevi/root/macro/file505QEz.o(.gnu.linkonce.t.__rs__H1Z11TResonnance_R7TBufferRPX01_R7TBuffer+0x1a): > undefined reference to `TResonnance type_info function' > collect2: ld returned 1 exit status > *** Interpreter error recovered *** > > > I'm not familiar at all with shared library (and C++ class neither), so any help is welcomed. One more question, > building a shared library for a class A (TAstroNuc) which calls other classes B (TNoyau) and C (TResonnance), do > I have to build additional shared libraries for A and B? > > Thanks in advance. > Nicolas > > -- > :-------------------------------: > : Nicolas de SEREVILLE : > : C.S.N.S.M. : > : Batiment 104 : > : 91405 ORSAY Campus : > : Tel : (+ 33) (0)1 69 15 52 29 : > : Fax : (+ 33) (0)1 69 15 50 08 : > :-------------------------------: > >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET