Page 1 of 1
my "hello world" whats wrong
Posted: Sun Jun 05, 2005 9:08 pm
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?
MAJOR NOOB!
Posted: Sun Jun 05, 2005 9:39 pm
by Armen138
Posted: Sun Jun 05, 2005 9:48 pm
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.
Posted: Sun Jun 05, 2005 9:50 pm
by Guest
new code same error
// holla.cpp
//
//////////////////////////////////////////////////////////////////////
#include "iostream"
#include "holla.h"
//////////////////////////////////////////////////////////////////////
using namespace std;
int main();
{
cout<<"halo2";
return 0;
}
Posted: Sun Jun 05, 2005 9:58 pm
by Armen138
Code: Select all
//////////////////////////////////////////////////////////////////////
#include "iostream"
#include "holla.h"
//////////////////////////////////////////////////////////////////////
using namespace std;
int main()
{
cout<<"halo2"
return 0;
}
Posted: Sun Jun 05, 2005 10:02 pm
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
Posted: Wed Jun 08, 2005 4:37 am
by Guest
#include<iostream>
Posted: Wed Jun 08, 2005 5:53 pm
by Midnight
armen had it guys
Posted: Wed Jun 08, 2005 6:25 pm
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
Posted: Wed Jun 08, 2005 10:45 pm
by hybrid
Shouldn't cout be in namespace std? Thus it should be std::cout or
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.