my "hello world" whats wrong

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Guest

my "hello world" whats wrong

Post by Guest »

heres my code,
//////////////////////////////////////////////////////////////////////
#include "iostream"
#include "holla.h"

//////////////////////////////////////////////////////////////////////
using namespace std;
int main();
{
cout;"halo2"


return 0;
}
it keeps saying missing function header what do i have to do? :oops: MAJOR NOOB!
Armen138
Posts: 298
Joined: Mon Feb 23, 2004 3:38 am

Post by Armen138 »

Code: Select all

cout<<"hello";
if you're looking for me, start looking on irc, i'm probably there.
Guest

Post by Guest »

want it say halo2 i get this error/ C:\Program Files\Microsoft Visual Studio\MyProjects\holla world\holla.cpp(10) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.
Guest

Post by Guest »

new code same error
// holla.cpp
//
//////////////////////////////////////////////////////////////////////
#include "iostream"
#include "holla.h"

//////////////////////////////////////////////////////////////////////
using namespace std;
int main();
{
cout<<"halo2";


return 0;
}
Armen138
Posts: 298
Joined: Mon Feb 23, 2004 3:38 am

Post by Armen138 »

Code: Select all

//////////////////////////////////////////////////////////////////////
#include "iostream"
#include "holla.h"

//////////////////////////////////////////////////////////////////////
using namespace std;
int main()
{
cout<<"halo2"


return 0;
} 
if you're looking for me, start looking on irc, i'm probably there.
ondrew
Posts: 20
Joined: Fri Oct 03, 2003 2:24 pm
Location: Czech Republic

Post by ondrew »

what about the semicolon after main? there shouldn't be one

Code: Select all

int main() <- no semicolon
{
     ...
}
edit:
@Armen138 damn, you were faster :D
Guest

Post by Guest »

#include<iostream>
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

armen had it guys
Myth
Posts: 81
Joined: Wed Apr 13, 2005 5:48 pm

Post by Myth »

"Guest" was right.

Code: Select all

//////////////////////////////////////////////////////////////////////
#include <iostream.h> // I changed it
#include "holla.h"

//////////////////////////////////////////////////////////////////////
// I removed the namespace
int main(void) // Added void, didn't know it was called a semicolon :?
{
cout<<"halo2"; // Here I've added ;


return 0;
} 
- Myth
hybrid

Post by hybrid »

Shouldn't cout be in namespace std? Thus it should be std::cout or

Code: Select all

using namespace std;
somewhere before. And don't forget to flush your output stream, e.g. by appending <<std::endl; to really get the output at the place where you want to have it.
Post Reply