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

[cobalt-developers] GCC and C++ on my cobalt - cant use iostream.h library??



I am a veteran windows/dos C++ programmer but new to C++ programming on
linux (been doing Perl scripting up until now). I put together a small C++
program as a test:

#include<iostream.h>

void main() {
cout << "The dog ate my linux book.";
}

And compiled using:
gcc test.cpp -o test

And I got the following errors:

/tmp/ccurlyjh.o: In function `main':
/tmp/ccurlyjh.o(.text+0x9): undefined reference to `cout'
/tmp/ccurlyjh.o(.text+0xe): undefined reference to `ostream::operator<<(char
const *)'
collect2: ld returned 1 exit status

I have tried this with various variations, including adding the following
lines to the program (as per GCC FAQ): "using std::cout;" and/or "using
namespace std;" to no avail.

I've also read that GCC won't link to libraries not compiled by GCC. Could
it be that the C++ libraries for iostream weren't compiled using GCC?

If not, what is the deal?

Kevin