Date: Tue, 19 Mar 1996 15:59:57 +0200 (IST) From: Eli Zaretskii To: "James N. Domingue" <76162 DOT 3324 AT compuserve DOT com> Cc: gcc gurus Subject: Re: djgpp In-Reply-To: <960317152140_76162.3324_GHM45-1@CompuServe.COM> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On 17 Mar 1996, James N. Domingue wrote: > When I try to run this simple program: > #include > > main() > { > cout << "Well, hi there.\n" ; > return 0; > } > I get the compiler error messges "undefined reference to 'cout' > "undefined reference to 'ostream:operator <<(char const *)'" The best way to avoid these errors is to use `gxx' instead of `gcc' to compile and link C++ programs. The reason of your problem is that `gcc' doesn't by default instruct the linker to scan the C++ class libraries which define `cout' and other C++ functions. You need to append -lgpp -lstdcxx to the end of your gcc command line to tell gcc about these C++ libraries. When you use `gxx', it does that for you, so you don't have to remember. And please be sure to search the DJGPP FAQ list (available as v2/faq200b.zip from the same place you got DJGPP) for any problem you have, before you post here. The above problem is explained in section 8.7 of the FAQ.