This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: About Linking of a simple C++ prog.
- To: brook_wc at sina dot com
- Subject: RE: About Linking of a simple C++ prog.
- From: pkurpis at keck dot hawaii dot edu (Peter Kurpis)
- Date: Thu, 11 Oct 2001 09:13:45 -1000 (HST)
- Cc: gcc-help at gcc dot gnu dot org
> I have tried g++ & gcc -lstdc++, it doesn't work either, although
> the error messages is different as follows:
> $PWD$g++ test.cpp
> $PWD$./a.out
> ld.so.1: ./a.out: fatal: libstdc++.so.2.10.0: open failed: No such file or direc
> tory
> Killed
Your program linked correctly this time, as an executable was created, but
your executable can't find libstdc++.so at runtime. There are a couple of
options:
- you can tell the executable where to look e.g. on Solaris, you
would set the environment variable
setenv LD_RUN_PATH <path_to_libstdc++>
- you can recompile, this time hardwiring the runtime search path
into the executable:
g++ -Wl,-rpath <path_to_libstdc++> test.cpp
assuming your g++ was configured to use GNU ld
note that that's an ell, not numeric 'one'