From owner-freebsd-questions@FreeBSD.ORG Thu Aug 26 05:36:32 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DAC9616A4CE for ; Thu, 26 Aug 2004 05:36:32 +0000 (GMT) Received: from dsl-mail.kamp.net (mail.kamp-dsl.de [195.62.99.42]) by mx1.FreeBSD.org (Postfix) with SMTP id C539843D58 for ; Thu, 26 Aug 2004 05:36:31 +0000 (GMT) (envelope-from root@pukruppa.de) Received: (qmail 26105 invoked by uid 513); 26 Aug 2004 05:40:33 -0000 Received: from root@pukruppa.de by dsl-mail by uid 89 with qmail-scanner-1.21 Clear:RC:1(213.146.114.24):SA:0(-4.9/5.0):. Processed in 0.547351 secs); 26 Aug 2004 05:40:33 -0000 X-Spam-Status: No, hits=-4.9 required=5.0 Received: from unknown (HELO reverse-213-146-114-24.dialin.kamp-dsl.de) (213.146.114.24) by dsl-mail.kamp.net with SMTP; 26 Aug 2004 05:40:32 -0000 Date: Thu, 26 Aug 2004 07:39:56 +0200 (CEST) From: Peter Ulrich Kruppa X-X-Sender: root@pukruppa.net To: Josh Paetzel In-Reply-To: <200408252158.39025.josh@tcbug.org> Message-ID: <20040826073150.I72872@pukruppa.net> References: <200408251940.07032.dsyphers@u.washington.edu> <200408251951.41684.dsyphers@u.washington.edu> <200408252158.39025.josh@tcbug.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed cc: David Syphers cc: questions@freebsd.org Subject: Re: help with 'hello world' X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Aug 2004 05:36:33 -0000 On Wed, 25 Aug 2004, Josh Paetzel wrote: > On Wednesday 25 August 2004 21:51, you wrote: >> On Wednesday 25 August 2004 07:46 pm, Kris Kennaway wrote: >>> On Wed, Aug 25, 2004 at 07:40:07PM -0700, David Syphers wrote: >>>> This compiles fine on SunOS using egcs-2.91.66. However, it >>>> fails on FreeBSD (gcc 3.4.2) and RedHat (gcc 3.2.3) with the >>>> bizarre error "`cout' undeclared". >>> >>> How are you compiling it? At a guess, it sounds like you're >>> using the C compiler (gcc) not the C++ compiler (g++). >> >> No, I'm using g++: >> >> yggdrasil> cat test.cpp >> #include >> >> int main() >> { cout << "Hello World"; >> return 0; } >> >> yggdrasil> g++ test.cpp >> test.cpp: In function `int main()': >> test.cpp:4: error: `cout' undeclared (first use this function) >> test.cpp:4: error: (Each undeclared identifier is reported only >> once for each function it appears in.) >> >> -David > > #include > Instead of these two lines > using std::cout; > using std::endl; you may use using namespace std; Regards, Uli. > > int main() > { > cout << "Hello World!" << endl; > return 0; > } > > > -- > Thanks, > > Josh Paetzel > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > +---------------------------+ | Peter Ulrich Kruppa | | Wuppertal | | Germany | +---------------------------+