help with 'hello world'

cpghost at cordula.ws cpghost at cordula.ws
Thu Aug 26 02:02:00 PDT 2004


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/


More information about the freebsd-questions mailing list