Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Originating-IP: [203.26.31.21]
From: "Gareth Pearce" <tilps@hotmail.com>
To: ahuja@yahoo.com, cygwin@cygwin.com
Subject: Re: Trouble compiling a trivial C++ program involving cout
Date: Fri, 06 Dec 2002 15:42:51 +0000
Mime-Version: 1.0
Content-Type: text/plain; format=flowed
Message-ID: <F117gVlB4guLiuejzM90001f538@hotmail.com>
X-OriginalArrivalTime: 06 Dec 2002 15:42:51.0497 (UTC) FILETIME=[22AB2590:01C29D3E]



>Hi all,
>
>I have a C++ program (resource.cpp):
>
>#include "iostream"
>
>...
>
>cout << value;
>
>...
>
>On compiling with "g++ resource.cpp", I get:
>resource.cpp:18: `cout' undeclared (first use this function)
>
>I've tried:
>g++ -I /usr/include/c++/3.2/ resource.cpp
>
>in which case I get the following:
>
>cc1plus: warning: changing search order for system directory
>"/usr/include/c++/3.2"
>cc1plus: warning:   as it has already been specified as a non-system
>directory
>g++ -I /usr/include/c++/3.2/ resource.cpp
>
>I've checked and iostream is present in /usr/include/c++/3.2/
>
>I'm sure this is something trivial, but havent managed to get
>to the bottom of it after considerable digging and head scratching.
>Any help will be much appreciated.
>
>Thanks,
>-Vineet
>

It is indeed trivial - as of gcc version 3 and later - it conforms to the 
c++ standard with increased accuracy ... as such the standard library 
elements are now in namespace std.

either std::cout - or a using namespace std directive - will be required for 
your code to be conforming the c++ standard and thus compile.

Gareth

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

