When add -Wl,-t, the information is as following -bash-3.00$ /lab/home/zuoqi/gcc32/gcc-gnu-ccs/bin/g++ hello.cpp -Wl,-t /usr/local/bin/ld: mode elf32_sparc_sol2 /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crt1.o /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crti.o /usr/ccs/lib/values-Xa.o /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crtbegin.o /var/tmp//cc6yKDr2.o -lstdc++ (/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../../libstdc++.so) -lm (/usr/lib/libm.so) -lgcc_s (/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../../libgcc_s.so) -lc (/usr/lib/libc.so) -lgcc_s (/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../../libgcc_s.so) -lc (/usr/lib/libc.so) /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crtend.o /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crtn.o /var/tmp//cc6yKDr2.o: In function `main': hello.cpp:(.text+0x20): undefined reference to `std::cout' hello.cpp:(.text+0x24): undefined reference to `std::cout' hello.cpp:(.text+0x48): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))' /usr/local/bin/ld: link errors found, deleting executable `a.out' collect2: ld returned 1 exit status 2011/4/19 Ian Lance Taylor <iant@xxxxxxxxxx>: > Qi Zuo <bitsunnyday@xxxxxxxxx> writes: > >> Following your instruction, I checked the libstdc++.so. But I don't >> know whether I've done the right check. > > It looks right. This is a strange problem. > > You said that you are using GNU ld. Try compiling hello.cpp with > -Wl,-t. That will show you the exact libstdc++ which the linker is > opening. > > Ian > -- Regards Qi Zuo School Of Computer Science and Technology Beijng Institute of Technology, China, 100081