g++ error on Solaris/Sparc undefined reference to std::cout
Qi Zuo
bitsunnyday@gmail.com
Tue Apr 19 13:21:00 GMT 2011
BTW, when I compiled MPC I met trouble with complex.h, after searched
on the web, I commented out the complex.h in config.h.in
/* Define to 1 if you have the <complex.h> header file. */
//#undef HAVE_COMPLEX_H
When "make check", there's some error, but the install was completed.
Did you ever met the same problem?
2011/4/19 Jonathan Wakely <jwakely.gcc@gmail.com>:
> 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
More information about the Gcc-help
mailing list