Unix Programming - libstdc: no such file or directory

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2004 > libstdc: no such file or directory





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author libstdc: no such file or directory
Doctor Bones

2004-10-21, 5:56 pm

PLease help. I have a decent amount of C++ experience on Windows, but
know nothing about Unix. I wrote a simple "Hello World" program on a
Solaris box which includes <iostream>. The program compiles when I
run g++ but when I attempt to execute a.out I get the following error:

ld.so.1: ./a.out: fatal: libstdc++.so.5: open failed: No such file or
directory
Killed


Can someone tell me what I need to do to configure my environment?
Nils O. Selåsdal

2004-10-21, 5:56 pm

On Thu, 21 Oct 2004 12:42:36 -0700, Doctor Bones wrote:

> PLease help. I have a decent amount of C++ experience on Windows, but
> know nothing about Unix. I wrote a simple "Hello World" program on a
> Solaris box which includes <iostream>. The program compiles when I
> run g++ but when I attempt to execute a.out I get the following error:
>
> ld.so.1: ./a.out: fatal: libstdc++.so.5: open failed: No such file or
> directory
> Killed
>
>
> Can someone tell me what I need to do to configure my environment?

Looks like it cannot find your libstdc++
You can execute it but
LD_LIBRARY_PATH=/path/where/libstdc++is/ ./a.out
Or make the runtime linker search there by adding command line flags to
the linking stage:
-Wl,-R,/path/where/libstdc++is/
Bjorn Reese

2004-10-22, 7:49 am

On Thu, 21 Oct 2004 12:42:36 -0700, Doctor Bones wrote:

> PLease help. I have a decent amount of C++ experience on Windows, but
> know nothing about Unix. I wrote a simple "Hello World" program on a
> Solaris box which includes <iostream>. The program compiles when I
> run g++ but when I attempt to execute a.out I get the following error:
>
> ld.so.1: ./a.out: fatal: libstdc++.so.5: open failed: No such file or
> directory


g++ keeps its iostream implementation in the library libstdc++.so.
A .so (shared object) file is like a dll file.

The problem is that g++, or more correctly its libstdc++.so library
is not installed into any of the default system library directories
and the program loader cannot find it. This is the error message
you are seing. The command "ldd a.out" also tells you that it cannot
find the path for the library.

You have three options.

1. You can get your system administrator to install g++ and its
header files and libraries on the system.

2. You can set the LD_LIBRARY_PATH environment variable to include
the path to where your libstdc++.so library is currently located.
Chances are that it is located in the same directory as libgcc,
which can be found with "g++ -print-libgcc-file-name".

3. Instead of linking with the shared version (the dll) of the
library, you can link with the static version. This means that
all the necessary library code is put directly into your program.
So the program will grow in size, but it will not have external
dependencies. This is done by adding the "-static" compiler option
when you compile with g++.

--
mail1dotstofanetdotdk

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com