Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Aug 2004 21:58:39 -0500
From:      Josh Paetzel <josh@tcbug.org>
To:        David Syphers <dsyphers@u.washington.edu>
Cc:        questions@freebsd.org
Subject:   Re: help with 'hello world'
Message-ID:  <200408252158.39025.josh@tcbug.org>
In-Reply-To: <200408251951.41684.dsyphers@u.washington.edu>
References:  <200408251940.07032.dsyphers@u.washington.edu> <20040826024626.GA25115@xor.obsecurity.org> <200408251951.41684.dsyphers@u.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <iostream>
>
> 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 <iostream>

using std::cout;
using std::endl;

int main()
{
	cout << "Hello World!" << endl;
	return 0;
}


-- 
Thanks,

Josh Paetzel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408252158.39025.josh>