libstdc++ linked as libstdc++.a

Stephen M. Webb stephen.webb@bregmasoft.com
Thu Nov 14 07:21:00 GMT 2002


On November 14, 2002 04:32 am, Christoph Bugel wrote:
> Similar to the original poster I want to link with the *static*
> libstdc++.a.  However, I am distributing a shared library, not an
> executable. (implemented in C++ but the API is extern "C")
>
> linking with -static doesn't work as I expected:
>
> Linux$ g++ -fPIC -shared -static hello.cc -o libhello.so
>
> Linux$ ldd ./libhello.so
> 	libstdc++.so.5 => /usr/lib/libstdc++.so.5
> 	(etc, etc)
>
> Do I have to use -nostdinc and pick all libraries by hand or is
> there an easier way?

Just explicitly add the libstdc++.a to the list of files to link, like 
any other library.  No need for -nostdinc.

-- 
Stephen M. Webb



More information about the Libstdc++ mailing list