Visual Studio 2008 Problem

Started by
16 comments, last by RedReaper132 15 years, 2 months ago
Hey guys, i am a beginner learning C++ It has become apperant that there is a compiling problem with the #include <iostream> i tried both of the following and the errors that i got are with them. #include <iostream.h> fatal error C1083: Cannot open include file: 'iostream.h' #include <iostream> error C2447: '{' : missing function header (old-style formal list?) Any Help?
Advertisement
Quote:Original post by Bradpm
Hey guys, i am a beginner learning C++

It has become apperant that there is a compiling problem with the #include <iostream> i tried both of the following and the errors that i got are with them.

#include <iostream.h>

fatal error C1083: Cannot open include file: 'iostream.h'

#include <iostream>

error C2447: '{' : missing function header (old-style formal list?)

Any Help?

#include <iostream> is correct. Can we see your code?
1: #include <iostream>
2:
3:
4: int main();
5: {
6: cout <<"Hello World!\n";
7: return 0;
8: }
Quote:Original post by Bradpm
1: #include <iostream>
2:
3:
4: int main();
5: {
6: cout <<"Hello World!\n";
7: return 0;
8: }
You don't want a semicolon at the end of line 4 there. That's what the error is referring to (Somewhat cryptically)
Don't put a semicolon after "int main()".

EDIT: Bah!
Mike Popoloski | Journal | SlimDX
I removed it and now i get 2 errors :S

error C2447: '{' : missing function header (old-style formal list?)
error C2065: 'cout' : undeclared identifier
Change cout <<"Hello World!\n"; to std::cout <<"Hello World!\n";
That worked :)

Just that one error left haha :)

error C2447: '{' : missing function header (old-style formal list?)

Here is the code:

#include <iostream>


int main()
{
std::cout <<"Hello World!\n";
return 0;
}
Are you sure this is all of the code you're trying to compile?
Quote:Original post by Bradpm
That worked :)

Just that one error left haha :)

error C2447: '{' : missing function header (old-style formal list?)

Here is the code:

#include <iostream>


int main()
{
std::cout <<"Hello World!\n";
return 0;
}
What line does the error refer to? Are you sure that's your exact code?

This topic is closed to new replies.

Advertisement