About Linking of a simple C++ prog.

brook_wc brook_wc@sina.com
Thu Oct 11 01:43:00 GMT 2001


Hi,
  I just installed gcc2.95 on Solaris 8 sparc.
  I also installed the binutils too.
  But when compiling the Hello program, I met the error message as followes:
  $PWD$gcc test.cpp
/var/tmp/ccwOXb2b.o: In function `main':
/var/tmp/ccwOXb2b.o(.text+0x4): undefined reference to `cout'
/var/tmp/ccwOXb2b.o(.text+0x8): undefined reference to `cout'
/var/tmp/ccwOXb2b.o(.text+0x14): undefined reference to `ostream::operator<<(cha
r const *)'
/var/tmp/ccwOXb2b.o(.text+0x24): undefined reference to `endl(ostream &)'
/var/tmp/ccwOXb2b.o(.text+0x28): undefined reference to `endl(ostream &)'
/var/tmp/ccwOXb2b.o(.text+0x2c): undefined reference to `ostream::operator<<(ostream &(*)(ostream &))'
collect2: ld returned 1 exit status

It seems that there is something wrong during the linking process. So what should I do?
Any suggestions or hints will be highly appreciated.

In addition, I enclose the code as follows://as you have expected
#include <iostream.h>
main()
{
   cout<<"hello"<<endl;
}



Chao
Nortel Networks
______________________________________

===================================================================
ÐÂÀËÃâ·Ñµç×ÓÓÊÏä ( http://mail.sina.com.cn )
ÐÂÀË·ÖÀàÐÅÏ¢£­£­³ÇÊÐÉú»îÖ¸ÄÏ£¡ ( http://classad.sina.com.cn/ )
ÊÀ½ç±­¡¢¼×A¡¢Å·ÖÞÁªÈü¡­¶©×ãÇò¶ÌÐÅ£¬Ó®ÊÖ»ú´ó½±£¡ ( http://sms.sina.com.cn/sport.html )



More information about the Gcc-help mailing list