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

c++ problem (gcc)



i tried to write a small c++ using iostream.
When i compiled it I got a linker error that it couldn't find cout and
relations.
I tried it on a simple hello world and got the same result:
micha:~/work/temp> gcc text.cpp
/tmp/cc5OYXpg.o: In function `main':~
/tmp/cc5OYXpg.o(.text+0x4): undefined reference to `endl(ostream &)'
/tmp/cc5OYXpg.o(.text+0xe): undefined reference to `cout'
/tmp/cc5OYXpg.o(.text+0x13): undefined reference to
`ostream::operator<<(char const *)'
/tmp/cc5OYXpg.o(.text+0x1e): undefined reference to
`ostream::operator<<(ostream &(*)(ostream &))'
collect2: ld returned 1 exit status

The file had a simple #include<iostream> (I tried also <iostream> )
and a cout << "Hello World" << endl;
As far as i remember it worked this way before.
What am i forgeting?
i tried to compile also under solaris something and got the  same error.
Thanx
michf@math.tau.ac.il


Reply to: