static libary ok, dynamic not ok, multiple definiton error

ivar@imaker.no ivar@imaker.no
Wed Sep 7 20:23:00 GMT 2005


Hello,
have some c++ files which I would like to compile to shared library.
I use the command
g++ -shared libmylibrary.so file1.o file2.o ....

I can create the library, but when I try to compile with the user program
lp.cpp I get a problem:

g++ lp.cpp -L. -lmylibrary

I get at lot of "mulitple definition" errors on symbols like init_ fp_hw
and many others.

If I try to make a static library using
ar cru libmylibrary.a file1.o file2.o ....
rans libmylibrary.a

and then compile the main program there are no errors.

Can somebody help me out ?
Best regards,
IB



More information about the Gcc-help mailing list