From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: cout problem Date: Wed, 28 Jan 1998 18:17:34 -0500 Organization: Cornell University (http://www.cornell.edu/) Lines: 38 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <34CFBC8D.C0CA2652@cornell.edu> References: <19980128223700 DOT RAA09679 AT ladder03 DOT news DOT aol DOT com> NNTP-Posting-Host: cu-dialup-0068.cit.cornell.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk MATTRUD wrote: > > >maybe if you say also *which* error you got > > Sorry, I thought that I mentioned this in my original posting. The > error I got was that cout was used without being initialized first. > But, according to the documentation, libio.h does initialize cout, as > well as cin and cerr. The listing again: > > #include > void main() > { > cout << "Hello World!/n"; > } your report is definitely not accurate. here's what happens when you try to compile your program exactly as typed: D:\djgpp\C\TEST> gcc -c ct.cc -Wall -O ct.cc:3: warning: return type for `main' changed to integer type ct.cc: In function `int main(...)': ct.cc:4: `cout' undeclared (first use this function) ct.cc:4: (Each undeclared identifier is reported only once ct.cc:4: for each function it appears in.) why do you include libio.h rather than iostream.h? don't forget to link with libiostr.a or use gxx for the executable. use \n rather than /n. of course, the proper way to do it with iostreams is cout << "Hello World" << endl; -- ---------------------------------------------------------------------- A. Sinan Unur Department of Policy Analysis and Management, College of Human Ecology, Cornell University, Ithaca, NY 14853, USA mailto:sinan DOT unur AT cornell DOT edu http://www.people.cornell.edu/pages/asu1/