About Linking of a simple C++ prog.
brook_wc
brook_wc@sina.com
Thu Oct 11 19:20:00 GMT 2001
Hi,
OK, This time, I tried
setenv LD_RUN_PATH /usr/local/lib,
and recompiled the program(recomplie is must, so I think .so has been linked to the execuatable)
and Yeah, now it works. When I remove LD_RUN_PATH, it works too.
And I have a question, Why need I do this? Is there anything wrong with the installation of gcc?
----- Original Message -----
From:pkurpis@keck.hawaii.edu (Peter Kurpis)
To:brook_wc@sina.com
Subject:RE: About Linking of a simple C++ prog.
Date:Fri, 12 Oct 2001 03:13:45 +0800
>> 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'
>
>
______________________________________
===================================================================
ÃÂÃÂÃÂÃÂÃÂâ÷ÃÂõçÃÂÃÂÃÂÃÂÃÂä ( http://mail.sina.com.cn )
ÃÂÃÂÃÂÃÂ÷ÃÂÃÂàÃÂÃÂ
ÃÂâãÃÂãÃÂóÃÂÃÂÃÂÃÂúûîÃÂøÃÂÃÂãá ( http://classad.sina.com.cn/ )
ÃÂÃÂýçñÃÂáâüÃÂAáâÃÂ
÷ÃÂÃÂÃÂêÃÂüáÃÂöéÃÂãÃÂòöÃÂÃÂÃÂ
ãìÃÂîÃÂÃÂûúôóýñãá ( http://sms.sina.com.cn/sport.html )
More information about the Gcc-help
mailing list