[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??



There really are two GNU compilers on your system; gcc and g++.  Use 'g++
test.cpp -o test'.  The default make rules (i.e. no makefile) would also work.

[tomc@css586 tmp]# make test
g++     test.cpp   -o test

Tom Cox

On Fri, 02 Feb 2001, you wrote:
> 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
-- 
--------------------
Tom A. Cox
Senior Programmer
Tri-Pacific Software
972-620-2520 ext. 23
www.tripac.com