On 20 June 2012 11:53, Syed Ahsan Ali Bokhari <ahsan.pmd@xxxxxxxxx> wrote: > The page says that > At runtime set LD_LIBRARY_PATH in your environment correctly, so that > the shared library for libstdc++ can be found and loaded. Be certain > that you understand all of the other implications and behavior of > LD_LIBRARY_PATH first. > > I have set LD_LIBRARY_PATH already in bashrc. Does it serves the purpose? It depends what you've set it to and whether you've exported it. If you've set it to destdir/lib that would explain the error, you probably need it to be destdir/lib64 > Compile the path to find the library at runtime into the program. This > can be done by passing certain options to g++, which will in turn pass > them on to the linker. The exact format of the options is dependent on > which linker you use: > > GNU ld (default on GNU/Linux): -Wl,-rpath,destdir/lib > > I can't understand this option. Can you explain a little please Read the manuals. -Wl, tells GCC to pass the following options to the linker, replacing commas with spaces. -rpath destdir/lib tells the linker to add a RT_RPATH or DT_RUNPATH entry with the contents destdir/lib, you should replace "destdir/lib" with the location of the shared library the executable needs.