Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Aug 2004 11:02:25 +0200
From:      cpghost@cordula.ws
To:        David Syphers <dsyphers@u.washington.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: help with 'hello world'
Message-ID:  <20040826090225.GA621@bsdbox.farid-hajji.net>
In-Reply-To: <200408251940.07032.dsyphers@u.washington.edu>
References:  <200408251940.07032.dsyphers@u.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 25, 2004 at 07:40:07PM -0700, David Syphers wrote:
> #include <iostream>
> 
> int main()
> {
> cout << "Hello World";

std::cout << "Hello World";

// or:

std::cout << "Hello World"
          << std::endl;

> return 0;

// There's nothing wrong with this, but the Standard says
// that main would return 0 anyway, if you don't say it
// explicitely.

> }

Or, as Uli and others pointed out,

use namespace std;

> This happens with <vector> too. However, I can use iostream.h and vector.h, 
> though it complains they're deprecated. 

This is the same problem:

#include <vector>
#include <map>

std::vector<double> aVector;
std::map<std::string, std::string> aMap;

Oh, and try using the c++ front-end instead of g++. 

> Thanks for the help,
> 
> -David

Cheers,
-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/



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