Re: [ROOT] Unable to link libraries to gui

From: cstrato@EUnet.at
Date: Mon Aug 20 2001 - 23:19:52 MEST


Hi Jiri

Thank you for your hint, sorrowly it does not work.
I get the following pattern:

g++ -O -o Mygui Mygui.o MyguiDict.o -L. -lMyClassB -lMyClassA
./libMyClassB.so: undefined reference to ctors of libMyClassA

g++ -O -o Mygui Mygui.o MyguiDict.o -L. -lMyClassA -lMyClassB
./Mygui.o: undefined reference to ctors of libMyClassB

g++ -O -o Mygui Mygui.o MyguiDict.o -L. -lMyClassB -lMyClassA -lMyClassB
./libMyClassB.so: undefined reference to ctors of libMyClassA

g++ -O -o Mygui Mygui.o MyguiDict.o -L. -lMyClassA -lMyClassB -lMyClassA
./Mygui.o: undefined reference to ctors of libMyClassB

Does this mean that I cannot load a library which is needed
by the other library only?

For this reason I tried to recompile library libMyClassB in
order to link it with libMyClassA:
gmake -f Makefile4MyClassB
g++ -O -Wall -fPIC -fsigned-char -I/usr/X11/include
-I/home/christian/rt/root/include -c MyClassB.cxx
Generating dictionary MyClassBDict...
g++ -O -Wall -fPIC -fsigned-char -I/usr/X11/include
-I/home/christian/rt/root/include -c MyClassBDict.cxx
g++ -shared -Wl,-soname, -O -o  libMyClassB.so MyClassB.o MyClassBDict.o -L.
-lMyClassA

Sorrowly, I am not able to link libMyClassB with libMyClassA.
Is there something wrong with the output above?
Where do I have to place -fPIC?
What do I have to do to link libMyClassB with libMyClassA?

P.S.: When running Mygui in CINT/ROOT everything works fine:
root [0] gSystem->Load("/home/christian/rt/rootcode/libMyClassA.so");
root [1] gSystem->Load("/home/christian/rt/rootcode/libMyClassB.so");
root [2] .x Mygui.C

Thank you in advance for your help

Best regards
Christian


Jiri Masik wrote:

> Hi Christian,
>
> if you are sure this constructor is implemented try to add the library
> which contains it once more on the command line
> g++ -O Mygui.o MyguiDict.o -L. -lMyClassB -lMyClassA -lMyClassB
> or swap -lMyClassA and -lMyClassB.
> GNU ld searches for undefined symbols in the rest of the archives not
> going to the first archive in the list again.
> cheers
> --
>         Jiri



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:58 MET