Mail Archives: djgpp/1998/03/19/23:58:54
At 04:21 3/19/1998 -0600, Scott Billings wrote:
>Well, that's not entirely true, it just won't compile using GCC. If I
>use something like GPP or G++ it will.
>
>This seems to be a problem with both GCC 2.7.2.1 and 2.8.0 (I'm using
>2.8 right now). If I try and compile something using the "gcc source.cpp
>-o source.exe" I get all kinds of errors about an undefined referance to
>cout and just about every other function I use. Yes, I did add the
>#include <iostream.h> at the top. I've also tried the -X c++ switch to
>no avail. I've even tried using different extensions, like .cc .cpp .cxx
>... None work.
You are *supposed* to use the gxx/gpp/g++ variant to link C++. If you read
the README.1ST you will see this. The problem is that there is no
fundamental difference between C and C++ object files, so the compiler
driver doesn't know what they are. C++ needs C++ libraries scanned to get
functions like the iostream operators. You must tell the compiler driver to
scan those libraries, by adding the `-lstdcxx' and `-liostr'(not sure if
`-liostr' is needed for 2.8) options. The `gxx' or whatever program is just
a simple wrapper which adds these options for you.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -