Building shared library that uses libstdc++

Alexandre Oliva aoliva@redhat.com
Mon Apr 16 12:14:00 GMT 2001


On Apr 16, 2001, "Lundell, Jens O." <JENS.O.LUNDELL@saic.com> 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.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc-help mailing list