From: John Wong Newsgroups: comp.os.msdos.djgpp,comp.lang.c++ Subject: Undefined cout? Date: Tue, 1 Apr 1997 11:54:47 +0800 Organization: Hong Kong School Net Lines: 40 Message-ID: Reply-To: John Wong NNTP-Posting-Host: ecs.school.net.hk Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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 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