libstdc++ linked as libstdc++.a
Stephen M. Webb
stephenw@cryptocard.com
Wed Nov 13 07:29:00 GMT 2002
On November 12, 2002 09:11 pm, B. Kosnik wrote:
> shared:
>
> g++ -o hello hello.cc
>
> static:
>
> g++ -static -o hello hello.cc
That won't work on certain target platforms (eg. Mac OS X, where
-static doesn't work), and also forces libc.a to be linked in
statically. A more portable alternative is (example using the POSIX
shell, localize as appropriate):
LIBCXX=`g++ -print-file-name=libstdc++.a`
g++ -o hello hello.cc $LIBCXX
Given the instability of the g++ ABI over the last year or so and the
way certain Linux distros do such weird things with the shared library
names, this should be pretty much the de facto modus operandi for
professional software releases.
If it's any comfort, we've had to do something similar with MSVC on
Windows, since their newer version of the C++ is ABI incompatible with
their older version.
--
Stephen M. Webb
More information about the Libstdc++
mailing list