This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Problem In compiling C++ codes
- To: aaboulhosn at entpm2 dot prod dot fedex dot com, help-gcc at gnu dot org
- Subject: Re: Problem In compiling C++ codes
- From: sherry <sherry at zeroknowledge dot com>
- Date: Fri, 23 Feb 2001 13:43:16 -0500
- References: <OFA187B618.9E7A71D8-ON862569FC.00641791@prod.fedex.com>
aaboulhosn@entpm2.prod.fedex.com wrote:
> But , when, I compile in C++ , no errors, But, when I type: a.out
> or ./a.out
> It give me this Error:
> ld.so.1 : a.out: fatal: libstdc++.so.2.10.0: open failed: No such file
> or directory
>
ld is gnu linker.
man ld will give you a lot of information about what it is and how it works.
So , to me it seems like you linked your executable with dynamic library,
and the linker can not find your library at run time.
(I hope David correct s me, if I am wrong again)
Now the linker does not use PATH to find the dynamic libraries on your system
but you can specify the path using -L option when linking (ld man pages again)
You can also link your program staticly , you should also know the difference
between
static and dynamic linking and advantages and disadvantages of each. (g++ man
pages for static linking)
(depending on you requirements one may be better than the other ......)
There is also the -rpath option that can be set when linking to help the
linker to find the
runtime libraries (check out man ld)
Did you read g++ man pages ? ... you must read it carefully
Another handy command to know is ldd , try
ldd ./a.out
to see what libraries are linked to your executable. (do not forget man ldd
;) )
>
> I checked my PATH:
> PATH=/usr/bin:/usr/local/:/usr/local/lib
>
> libstdc++.so.2.10.0 exist under this directory:
> /usr/local/lib
>
> I tired to copy : libstdc++.so.2.10.0 to the directory where a.out is ,
> (as a test)it does not help
This won't help ;)
>
> Thank you
> I appreciate it if you , continue working with me until I resolve this
> problem
>
> AREF