Building shared library that uses libstdc++
Lundell, Jens O.
JENS.O.LUNDELL@saic.com
Tue Apr 17 17:43:00 GMT 2001
Thank you very much Alex, it worked.
It would be nice if some of these common compiler switch combinations were
collected into a FAQ or something. It's not easy to correctly put all the
pieces together from the "GCC Command Options" page. Especially since some
of the information is in the wrong place, "-mimpure-text" is for example
described under AMD29K options instead of under SPARC options.
Thanks,
Jens
> Alexandre Oliva wrote:
> Jens Lundell wrote:
> > g++ -fPIC -mimpure-text -shared -o libjens.so source.cpp
> > /usr/local/lib/libstdc++.a.2.10.0
>
> > which compiles fine but both ldd and elfdump reveals that
> > the resulting library (libjens.so) still depends on
> > libstdc++.so.2.10.0.
>
> That's because g++ implicitly adds -lstdc++ to the link command
> line. Try -nodefaultlibs, and add -lgcc -lc -lgcc to the link command
> line.
More information about the Gcc-help
mailing list