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? 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 Regards On Wed, Jun 20, 2012 at 1:29 PM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > On 20 June 2012 05:46, Syed Ahsan Ali Bokhari wrote: >>> >>> Dear All, >>> >>> I am having following error while running an executable that was compiled using gfortran. Please guide me. >>> >>> [root@pmd03 bin]# ./int2lm_seq_v1.18 >>> ./int2lm_seq_v1.18: error while loading shared libraries: libgfortran.so.3: wrong ELF class: ELFCLASS32 > > The runtime linker is finding the 32-bit version of libgfortran.so.3 > but you are trying to run a 64-bit program. > > There are a number of ways to tell the dynamic linker how to find the > right library, see > http://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic