On Wed, Mar 01, 2000 at 04:39:45PM -0500, [EMAIL PROTECTED] wrote:
> On Wed, 1 Mar 2000, John Starkey wrote:
>
> > /tmp/cc2fWQbM.o: In function 'main':
> > /tmp/cc2fWQbM.o(.text+0x4): undefined reference to 'endl(ostream &)'
> > /tmp/cc2fWQbM.o(.text+0xe): undefined reference to 'cout'
> > /tmp/cc2fWQbM.o(.text+0x13): undefined reference to
> > 'ostream::operator<<(char const *)'
> > /tmp/cc2fWQbM.o(.text+0x1e): undefined reference to
> > 'ostream::operator<<(ostream &(*)(ostream &))'
> > collect2: ld returned 1 exit status
>
> EXCUSE ME? That **** doesn't look like c to me. c++ maybe, that has a
> cloven hoof and I don't touch it. Not even well done. try naming it as
> a c++ file, suffix can be .C or .cc or .cxx(?), or if you want to call
> it .c, compile it with g++.
The suffix tricks don't work reliably at all. I'm using gcc 2.95.2
and with a simple program:
#include <iostream.h>
int main(void){ cout<<"Hello World"<<endl; }
if I call it file.c or file.C or file.cc or file.cpp or file.cxx
and compile it with gcc 'filename', I still get similar errors to what
he's getting above.
Invoking gcc as g++ will deal with the problem, as well as
gcc filename -lstdc++ . However recognition of file extensions is
broken.
have fun
greg
--
you know. C++ in C means to evaluate C and then increment it.
So C++ doesn't improve on C until after you are done using it.
If it actually did something for the programmer, why not call it ++C?
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs