This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

About Linking of a simple C++ prog.


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]