Mail Archives: djgpp/1997/04/01/01:17:10
I've got a question about DJGPP installation. Now I've just installed
DJGPP 2.0, and find the following program doesn't compile:
#include <iostream.h>
class X {
int val;
public:
X() {val = 0;}
X(int i) {val = i;}
void func() const { cout << val << '\n'; }
};
main()
{
X v1;
v1.func();
X(3).func();
return 0;
}
gcc returns the following statements:
test.cc(.text+0x5e): undefined reference to `cout'
test.cc(.text+0x63): undefined reference to `ostream::operator<<(int)'
test.cc(.text+0x6e): undefined reference to `ostream::operator<<(char)'
It seems to be a problem with g++, since when I replace iostream.h with
stdio.h and cout with the C-style printf, everything's alright and the
program runs as expected.
What's wrong with my g++ installation (or even my code)? How to install
DJGPP correctly?
Any help would be much appreciated.
John
- Raw text -