delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/18/18:45:17.1

From: jazzyjeff34 AT hotmail DOT com (Klytu)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Strange compiler errors
Date: 18 Feb 2003 15:39:42 -0800
Organization: http://groups.google.com/
Lines: 66
Message-ID: <250404d5.0302181539.167cbc20@posting.google.com>
References: <20030218200121 DOT 65350 DOT qmail AT web13001 DOT mail DOT yahoo DOT com>
NNTP-Posting-Host: 66.2.44.105
X-Trace: posting.google.com 1045611582 7221 127.0.0.1 (18 Feb 2003 23:39:42 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 18 Feb 2003 23:39:42 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019