hi
i have red hat linux installed in my system.
[babu@localhost h]$ uname -a
Linux localhost.localdomain 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:32:14 EDT 2005 i686 i686 i386 GNU/Linux
[babu@localhost h]$ cat /proc/version
Linux version 2.6.9-22.ELsmp (bhcompile@porky.build.redhat.com) (gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)) #1 SMP Mon Sep 19 18:32:14 EDT 2005
the default gcc compiler version is
gcc version 3.4.4 which had present in my system.
i have upgraded the gcc to version 4.2.2.
now when i compiled the program (which uses external library) ,there was no problem. but when i run the program i got the following error.
[babu@localhost h]$ ./a.out
./a.out: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./a.out)
when i used ldd command to view the shared dependencies i got the following
[
babu@localhost h]$ ldd ./a.out
./a.out: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./a.out)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00829000)
libm.so.6 => /lib/tls/libm.so.6 (0x00517000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x007e1000)
libc.so.6 => /lib/tls/libc.so.6 (0x003eb000)
/lib/ld-linux.so.2 (0x003d2000)
here i have noticed that the gcc(version 4.2.2)libraries reside in /usr/local/lib
but note that in the above command the program is linked to libraries which is residing in the /usr/lib path (which is the old gcc version library path)
so i explicitly gave the library path in the command like this which points to gcc-4.2.2 version libraries.
[babu@localhost h]$ g++ -Wall simple_xy_wr.cpp /usr/local/lib/libnetcdf_c++.a /usr/local/lib/libnetcdf.a
/usr/local/lib/libstdc++.a
and now its working fine and when the shared dependencies are checked i got this
[
babu@localhost h]$ ldd a.out
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00829000)
libm.so.6 => /lib/tls/libm.so.6 (0x00517000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x007e1000)
libc.so.6 => /lib/tls/libc.so.6 (0x003eb000)
/lib/ld-linux.so.2 (0x003d2000)
ie. there is no change in the dependency path but after specifying the library path while compiling its working
very
now i wnt to uninstall the old gcc(which is given by distro ,how to uninstall) or
is there any other solution for this problem(such as always the gcc command links to libraries in the path /usr/local/lib/ rather than pointing to old gcc version libraries which is present in /usr/lib/ path)