Digvijoy Chatterjee writes: > On 5/26/06, David M. O'Brien <dmo61@xxxxxxxxxx> wrote: > > Can anyone suggest a fix for this?? > > > > > > I am compiling a program with gcc-3.4.5 g++. > > When I go to execute that program I get the following: > > > > ld.so.1: ./prog1: fatal: libstdc++.so.6: open failed: No such file or directory > > > > I can solve the issue by setting my LD_LIBRARY_PATH to the directory where > > libstdc++.so.6 is located. > > > > This program used to run with gcc-2.95.3 without resetting LD_LIBRARY_PATH. > > > > Question I have, > > > > Is there a way to compile my program so that there is no need to have the > > libstdc++.so.6 at runtime? Can I create a prog1, that contains all symbols and > > no need for this library when executing? > > > > If so, what are the command options for doing that? I have read over the g++ and > > ld documentation but can not seem to find the correct combination. > hi Dave , > You can link it statically if you are ready to have a huge executable, > if you do that then Dynamic Linking would not be needed at all ,all > the linking would be built inside the executable > I think -static is the switch to do that Static linkage is problematic on GNU/Linux and similar systems. If you must link statically with libstdc++, it's probably better to link statically only with that library. You can do that with something like: gcc test.cc -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic but in general we don't recommend static linkage at all. Andrew.