Mail Archives: djgpp/2003/02/18/18:45:17.1
Thomas Tutone <thomas8675309 AT yahoo DOT com> wrote in message news:<20030218200121 DOT 65350 DOT qmail AT web13001 DOT mail DOT yahoo DOT com>...
> [snip]
>
> > (A side problem I noticed is
> > that if I don't include <iostream>, I get errors
> > indicating that cout
> > and cin are undefined. I thought including
> > <iostream> after <fstream>
> > is already included was redundant or am I wrong
> > about that?
>
> You're wrong about that. The standard requires that
> std::cout and std::cin be defined in <iostream>. It
> is implementation-defined whether other headers
> indirectly include the common code to define std::cout
> and std::cin as well. If you don't need std:cout or
> std::cin and are only doing file i/o, then including
> <fstream> should be sufficient. But if you need to
> use std::cin, std::cout, or std:cerr, then you must
> include <iostream> for the program to be portable.
OK. As I found out earlier today, the book I read that says that
fstream includes all the declarations in iostream ("C++ in Plain
English" by Brian Overland, 2nd Edition p.443) is just plain wrong.
[snip]
>
> > Basically everything was installed properly and I
> > changed
> > nothing (I might have changed the order of the
> > includes in my source,
> > but I am not sure). Suddenly everything compiles
> > with no errors now. I
> > would post the exact error messages I got if I
> > could remember them,
> > but suffice it to say that all the generated errors
> > were in indirectly
> > included files that were not in my source but in
> > the standard library.
> > Any explanation for this would be appreciated!
>
> If you can't reproduce the errors, it's hard to
> diagnose what the problem was. But it's possible you
> mixed deprecated and standard headers in the same
> program (<stdlib.h> instead of <cstdlib> for example),
> and that when you changed the order of the header
> files, you also corrected that error. But the
> blizzard's knocked out my crystal ball, so I don't
> know for sure. If the problem returns, post some code
> that reproduces it, along with the error messages.
Understood, that it's difficult to help without more details. I'll
post them if it happens again. But I was not using deprecated headers
or mixing deprecated with standard headers. I was hoping someone else
had encountered something similar. Guess I could use a crystal ball
myself. Thanks anyway.
>
> Best regards,
>
> Tom
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! News - Today's headlines
> http://news.yahoo.com
- Raw text -