Re: g++ error on Solaris/Sparc undefined reference to std::cout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Following your instruction, I checked the libstdc++.so. But I don't
know whether I've done the right check.

first check the missing reference

-bash-3.00$ /lab/home/zuoqi/gcc32/gcc-gnu-ccs/bin/g++ hello.cpp
/var/tmp//ccz4peUZ.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> >&))'
collect2: ld returned 1 exit status

find cout

-bash-3.00$ nm /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/libstdc++.so|grep
cout
000e1050 b _ZN14__gnu_internal13buf_cout_syncE
000e0db0 b _ZN14__gnu_internal14buf_wcout_syncE
000e0f48 b _ZN14__gnu_internal8buf_coutE
000e0ca0 b _ZN14__gnu_internal9buf_wcoutE
000e13e0 b _ZSt4cout
000e1198 B _ZSt5wcout

find basic_ostream

-bash-3.00$ nm /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/libstdc++.so|grep
basic_ostream
00085ae0 W _ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv
00085798 W _ZNSt13basic_ostreamIwSt11char_traitsIwEE3putEw
00084fec W _ZNSt13basic_ostreamIwSt11char_traitsIwEE5flushEv
000851f4 W _ZNSt13basic_ostreamIwSt11char_traitsIwEE5seekpESt4fposI11__mbstate_tE
00085338 W _ZNSt13basic_ostreamIwSt11char_traitsIwEE5seekpExSt12_Ios_Seekdir
000850cc W _ZNSt13basic_ostreamIwSt11char_traitsIwEE5tellpEv
00085610 W _ZNSt13basic_ostreamIwSt11char_traitsIwEE5writeEPKwi
00085514 W _ZNSt13basic_ostreamIwSt11char_traitsIwEE6sentryC1ERS2_
00085514 W _ZNSt13basic_ostreamIwSt11char_traitsIwEE6sentryC2ERS2_
00085584 W _ZNSt13basic_ostreamIwSt11char_traitsIwEE6sentryD1Ev
00085584 W _ZNSt13basic_ostreamIwSt11char_traitsIwEE6sentryD2Ev
00084f94 W _ZNSt13basic_ostreamIwSt11char_traitsIwEE8_M_writeEPKwi
00087330 t _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIPKvEERS2_T_
000867e0 t _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIbEERS2_T_
00086e74 t _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIdEERS2_T_
000870d8 t _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIeEERS2_T_
00086310 t _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIlEERS2_T_
0008659c t _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertImEERS2_T_
00086a0c t _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIxEERS2_T_
00086c40 t _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIyEERS2_T_
00084e9c W _ZNSt13basic_ostreamIwSt11char_traitsIwEEC1EPSt15basic_streambufIwS1_E
00085480 W _ZNSt13basic_ostreamIwSt11char_traitsIwEEC1Ev
00084e70 W _ZNSt13basic_ostreamIwSt11char_traitsIwEEC2EPSt15basic_streambufIwS1_E
00085454 W _ZNSt13basic_ostreamIwSt11char_traitsIwEEC2Ev
00082638 W _ZNSt13basic_ostreamIwSt11char_traitsIwEED0Ev
00082588 W _ZNSt13basic_ostreamIwSt11char_traitsIwEED1Ev
00084f30 W _ZNSt13basic_ostreamIwSt11char_traitsIwEED2Ev
00084f48 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEPFRS2_S3_E
00084f78 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEPFRSt8ios_baseS4_E
00084f5c t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEPFRSt9basic_iosIwS1_ES5_E
00087550 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEPKv
00085944 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEPSt15basic_streambufIwS1_E
00086a00 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEb
000870cc t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEd
00087308 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe
0008709c t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEf
00086530 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEi
000867bc t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEj
00086590 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEl
000867d4 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEm
0008653c t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEs
000867c8 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEt
00086c34 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEx
00086e68 t _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEy
0006a278 W _ZNSt9basic_iosIwSt11char_traitsIwEE3tieEPSt13basic_ostreamIwS1_E
00083554 W _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
00085c7c W _ZSt16__ostream_insertIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_PKS3_i
0008335c W _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
00085ae8 W _ZSt4endlIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_
000833e8 W _ZSt4endsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
00085b38 W _ZSt4endsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_
000833f8 W _ZSt5flushIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
00085b48 W _ZSt5flushIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_
00083aa0 W _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKa
000839a8 W _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
00083a54 W _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKh
00083a14 W _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_a
000839f4 W _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c
00083a34 W _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_h
0008349c W _ZStlsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_St12_Setiosflags
00083524 W _ZStlsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_St13_Setprecision
000834bc W _ZStlsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_St14_Resetiosflags
0008353c W _ZStlsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_St5_Setw
000834dc W _ZStlsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_St8_Setbase
00083404 W _ZStlsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_St8_SetfillIS3_E
000820c4 W _ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKSbIS4_S5_T1_E
0004bf04 W _ZStlsIdcSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E
0004d718 W _ZStlsIdwSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E
0004c7a4 W _ZStlsIecSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E
0004d230 W _ZStlsIewSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E
0004c350 W _ZStlsIfcSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E
0004cd40 W _ZStlsIfwSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E
000860a0 W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_PKS3_
0008610c W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_PKc
000860ec W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_S3_
00085bc4 W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_St12_Setiosflags
00085c4c W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_St13_Setprecision
00085be4 W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_St14_Resetiosflags
00085c64 W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_St5_Setw
00085c04 W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_St8_Setbase
00085b54 W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_St8_SetfillIS3_E
000862b8 W _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_c
00082430 W _ZStlsIwSt11char_traitsIwESaIwEERSt13basic_ostreamIT_T0_ES7_RKSbIS4_S5_T1_E
000dc340 d _ZTCSt13basic_fstreamIwSt11char_traitsIwEE8_St13basic_ostreamIwS1_E
000dc560 d _ZTCSt14basic_iostreamIwSt11char_traitsIwEE8_St13basic_ostreamIwS1_E
000dc2e0 d _ZTCSt14basic_ofstreamIwSt11char_traitsIwEE0_St13basic_ostreamIwS1_E
000dd0b0 d _ZTCSt18basic_stringstreamIwSt11char_traitsIwESaIwEE8_St13basic_ostreamIwS1_E
000dd050 d _ZTCSt19basic_ostringstreamIwSt11char_traitsIwESaIwEE0_St13basic_ostreamIwS1_E
000dcce0 V _ZTISt13basic_ostreamIwSt11char_traitsIwEE
000b50c8 V _ZTSSt13basic_ostreamIwSt11char_traitsIwEE
000dcd28 V _ZTTSt13basic_ostreamIwSt11char_traitsIwEE
000dcd30 V _ZTVSt13basic_ostreamIwSt11char_traitsIwEE
00082620 W _ZTv0_n12_NSt13basic_ostreamIwSt11char_traitsIwEED0Ev
00082570 W _ZTv0_n12_NSt13basic_ostreamIwSt11char_traitsIwEED1Ev

2011/4/19 Jonathan Wakely <jwakely.gcc@xxxxxxxxx>:
> On 19 April 2011 13:09, Qi Zuo wrote:
>>
>> -bash-3.00$ /lab/home/zuoqi/gcc32/gcc-gnu-ccs/bin/g++ hello.cpp
>> /var/tmp//ccDqluzK.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> >&))'
>> collect2: ld returned 1 exit status
>>
>> the paths checked by -v as following
>>
>> -bash-3.00$ /lab/home/zuoqi/gcc32/gcc-gnu-ccs/bin/g++ hello.cpp -v
>> Using built-in specs.
>> COLLECT_GCC=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/bin/g++
>> COLLECT_LTO_WRAPPER=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/libexec/gcc/sparc-sun-solaris2.10/4.6.0/lto-wrapper
>> Target: sparc-sun-solaris2.10
>> Configured with: ../gcc-4.6.0/configure ABI=32
>> --prefix=/lab/home/zuoqi/gcc32/gcc-gnu-ccs --with-gnu-as
>> --with-as=/usr/local/bin/as --with-gnu-ld --with-ld=/usr/local/bin/ld
>> --enable-languages=c,c++,java
>> --with-gmp-include=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/include
>> --with-gmp-lib=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib
>> --with-mpfr-include=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/include
>> --with-mpfr-lib=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib
>> --with-mpc-include=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/include
>> --with-mpc-lib=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib --without-ppl
>> --without-cloog --enable-plugin --enable-lto
>> Thread model: posix
>> gcc version 4.6.0 (GCC)
> ...
>> LIBRARY_PATH=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/:/usr/ccs/lib/:/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../../:/lib/:/usr/lib/
>
>
> I suggest you look in these paths to find libstdc++.so and then run
> 'nm' on it to see if it contains the missing symbols.
>



-- 
Regards
Qi Zuo

School Of Computer Science and Technology
Beijng Institute of Technology, China, 100081


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux