Mail Archives: djgpp/1998/01/29/12:00:33
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 <libio.h>
> 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/
- Raw text -