Cannot link hello world with g++ 3.1 under AIX 4.3.3

George Rogers
Tue Dec 3 06:44:00 GMT 2002

I am not able to get a successful link of a "Hello world" program under g++ 3.1
on AIX 4.3.3.  The same program works fine under HPUX 11.00 and Solaris 2.7
(g++ 3.1) and a similar C (not C++) program works fine under AIX 4.3.3.
(I am also able to build gcc/g++ 3.1 using gcc 3.1 under AIX 4.3.3).  Can 
give me advice on how to fix this problem?

Here is the information on g++, the program, and the link errors

~/testDir [29]>g++ -v
Reading specs from /usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/3.1/specs
Configured with: ../gcc-3.1/configure --disable-multilib 
--enable-threads=posix --enable-languages=c,c++
Thread model: aix
gcc version 3.1
~/testDir [30]>cat hello.cpp
#include <iostream>

int main(int argv, char **argc)
     std::cout << "Hello world!" << std::endl;

~/testDir [31]>g++ hello.cpp
ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, 
std::char_traits<char> >& std::operator<< 
<std::char_traits<char> >(std::basic_ostream<char, 
std::char_traits<char> >&, char const*)
ld: 0711-317 ERROR: Undefined symbol: std::basic_ostream<char, 
std::char_traits<char> >& std::endl<char, 
std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)
ld: 0711-317 ERROR: Undefined symbol: .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> >&))
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status

More information about the Gcc-help mailing list