help with 'hello world'

Kris Kennaway kris at obsecurity.org
Wed Aug 25 19:46:27 PDT 2004


On Wed, Aug 25, 2004 at 07:40:07PM -0700, David Syphers wrote:
> It's been a while since I wrote anything in C++, but this is sad - I can't get 
> hello world to compile. Could some kind person please tell me what, exactly, 
> is wrong with:
> 
> #include <iostream>
> 
> int main()
> {
> cout << "Hello World";
> return 0;
> }
> 
> 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++).

Kris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040825/dd496d6e/attachment.bin


More information about the freebsd-questions mailing list