Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Originating-IP: [203.26.31.21] From: "Gareth Pearce" To: ahuja AT yahoo DOT com, cygwin AT cygwin DOT 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: 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/