That's all I got. A .cpp. That's it. And all the code is just that.
I know C,now I want to do C++ and it's just give random errors when trying to compile. As far as I'm concerned... my code is fine... isn't that right???
In future please take the trouble to copy and paste the code and errors as text into you message rather than pasting a screen shot.
The problem is not in your code it is in the header iosfwd which is presumably included through iostream.
Check your compile options to make sure they are correct, pay particular attention to the precompiled header options.
Thx, but can you be more specific??? I don't really know where to find the options.....
The code in text
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello"<< endl;
return 0;
}
Here are the error in text...
Error 1 error C2146: syntax error : missing ';' before identifier '_Fpz' c:\program files\microsoft visual studio 8\vc\include\io sfwd 34
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 34
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 34
Error 4 error C2061: syntax error : identifier 'fpos_t' c:\program files\microsoft visual studio 8\vc\include\io sfwd 50
Error 5 error C2146: syntax error : missing ';' before identifier 'seekpos' c:\program files\microsoft visual studio 8\vc\include\io sfwd 65
Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 65
Error 7 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 66
Warning 8 warning C4183: 'seekpos': missing return type; assumed to be a member function returning 'int' c:\program files\microsoft visual studio 8\vc\include\io sfwd 68
Error 9 error C2146: syntax error : missing ';' before identifier '_Fpos' c:\program files\microsoft visual studio 8\vc\include\io sfwd 117
Error 10 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 117
Error 11 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 117
Error 12 error C2065: 'EOF' : undeclared identifier c:\program files\microsoft visual studio 8\vc\include\io sfwd 510
That's all I got. A .cpp. That's it. And all the code is just that.
I know C,now I want to do C++ and it's just give random errors when trying to compile. As far as I'm concerned... my code is fine... isn't that right???
did u create solution and empty project for this code?
It's "Non Using Precompiled Headers" There are options..... Create precompiled headers, Use precompiled headers, <inherit from parent or project default>
Did you do this:
1) Create a C++ Win32 Project
2) When rthe wizard appeared you did not click Finish but instead clicked Application Settings
3) then you selected a) console application and b) empty project
4) then you clicked Finish.
5) then you ADDED a .cpp file to the project
If you didn't do this exactly, your project and .cpp file are not set up correctly.
Be sure you didn't confuse C++ with C#.
Normally, you don't get a .cpp file by creating a project. You create a project and then ADD a cpp file to the project.
Your attachment does not show the Solution Explorer so I can't tell if the .cpp file is part of your project.
Comment