Hello i am watching some tutorials on 3d Buzz and intro to C++ starts by saying that

#include <iostream>

main () 
{
	std::cout << "hello world!" << std::endl ;
}

should show a CMD like window saying Hello World!

On the video they try it and it works i try it and get error message

c:\users\nat\documents\visual studio 2008\projects\Hello World\Hello world\hello.cpp(4) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Why do i get this error message i have followed everything i have been told to,

Try typing in:

int main()

instead of main().

Also most people write that code a bit differently.

#include<iostream>
using namespace std;

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

This gets rid of the need to use std before all of those calls.

Apparently not.

The function main() must always be specified "int main()". If your tutorial doesn't show you that, get a new tutorial because you're in for a long tedious ride.

[edit=someone beat me to it]

Try typing in:

int main()

instead of main().

Also most people write that code a bit differently.

#include<iostream>
using namespace std;

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

This gets rid of the need to use std before all of those calls.

There's nothing wrong with the way he wrote it, he just forgot the "int".

It could also be written:

#include<iostream>
using std::cout;
using std::endl;

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

It's almost as common.
[/edit]

cheers the int main () works fine

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.