Error with iostream.h

Richard James Lewis Richard.Lewis@uea.ac.uk
Thu Jul 11 07:09:00 GMT 2002


I've recently installed Red Hat Linux 7.3.
The following program won't compile with command: gcc test.cc
test.cc:
#include <iostream.h>

int main() {
  cout << "Hello World!" << endl;

  return 0;
}

it seems to think that cout is undefined:

/tmp/ccY0SwAX.o: In function `main':
/tmp/ccY0SwAX.o(.text+0xa): undefined reference to `endl(ostream &)'
/tmp/ccY0SwAX.o(.text+0x17): undefined reference to `cout'
/tmp/ccY0SwAX.o(.text+0x1c): undefined reference to
`ostream::operator<<(char const *)'
/tmp/ccY0SwAX.o(.text+0x27): undefined reference to
`ostream::operator<<(ostream &(*)(ostream &))'
collect2: ld returned 1 exit status

Any ideas?



More information about the Gcc-help mailing list