[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-developers] GCC and C++ on my cobalt - cant use iostream.h library??
- Subject: RE: [cobalt-developers] GCC and C++ on my cobalt - cant use iostream.h library??
- From: "Kal Amry" <kamry1888@xxxxxxxxx>
- Date: Fri Feb 2 13:20:02 2001
- List-id: Discussion Forum for developers on Cobalt Networks products <cobalt-developers.list.cobalt.com>
Use g++, I believe gcc is a c compiler! Also, the gnu g++ compiler accepts
<iostream> without the h although I think it also takes it with the h, so
just a tip for you... Also, you can compile using:
g++ -s test.cpp "to get a smaller executable"
the above line will give an a.out exe so to run that, I think you need to do
it explicitly by doing:
./a.out at the command line
To view all errors and warning, use -Wall (Capital w and the rest in lower
cases)
Read the man g++ and info g++
Kal Amry
-----Original Message-----
From: cobalt-developers-admin@xxxxxxxxxxxxxxx
[mailto:cobalt-developers-admin@xxxxxxxxxxxxxxx]On Behalf Of Kevin D
Sent: Friday, February 02, 2001 2:33 PM
To: cobalt-developers@xxxxxxxxxxxxxxx
Subject: [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
_______________________________________________
cobalt-developers mailing list
cobalt-developers@xxxxxxxxxxxxxxx
http://list.cobalt.com/mailman/listinfo/cobalt-developers
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com