www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/23/08:00:04

From: "A. Sinan Unur" <asu1 AT cor-nell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++ Problem
Date: 23 Jul 2002 11:52:39 GMT
Organization: Cornell University
Lines: 42
Sender: asu1 AT cornell DOT invalid (on pool-141-149-206-88.syr.east.verizon.net)
Message-ID: <Xns92545021BD616asu1cornelledu@132.236.56.8>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1020723080228 DOT 28370C-100000 AT is> <X9b%8.1034150$yP6 DOT 33807330 AT Flipper>
NNTP-Posting-Host: pool-141-149-206-88.syr.east.verizon.net
X-Trace: news01.cit.cornell.edu 1027425159 6496 141.149.206.88 (23 Jul 2002 11:52:39 GMT)
X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu
NNTP-Posting-Date: 23 Jul 2002 11:52:39 GMT
User-Agent: Xnews/5.04.25
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Daniel Noorduin" <w DOT noorduin AT chello DOT nl> wrote in
news:X9b%8.1034150$yP6 DOT 33807330 AT Flipper: 

> 
>> > C:/djgpp/lang/cxx-v31/backward/iostream.h(31) In file included from
>> > C:/djgpp/lang/cxx-v31/backward/iostream.h:31
>> > C:/djgpp/lang/cxx-v31/backward/backward_warning.h(32) Error: 2:
>> > warning 
> This
>> > file includes at least one antiquated header.... etc. To disable
>> > this warning use -Wno-deprecated.
>>
>> For the second problem, use <iostream> instead of <iostream.h>.
> 
> I already tried that. It recognizes the name iostream but goes on
> complaining about the iostream functions I use. Since I'm new to C++
> it might very well be something i overlooked or some other stupid
> mistake on my part. I copied the example program code straight from a
> tutorial written especially for RHIDE and DJGPP, so I assumed it would
> work if i could only manage to set up my compiler. Anyway here's what
> it says this time (with iostream instead of iostream.h):
> 
> Error: cout undeclared (first use in this function)
> Error: endl undeclared (first use in this function)
> Error: (Each undeclared identifier is reported only once for each
> function it appears in)

cout and endl live in the std namespace. gcc 3.0.x enforces namespaces 
and does not automatically put everything in std into the global 
namespace. so, you either need a 

using std;

after your includes, or need to refer to cout as std::cout. AFAIK, the 
latter is preferred so as to reduce namespace pollution.


-- 
A. Sinan Unur
asu1 AT c-o-r-n-e-l-l DOT edu
Remove dashes for address
Spam bait: mailto:uce AT ftc DOT gov

- Raw text -


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