C/C++ help IDE VC++ no exp.?

Im using Visual C++ 2010 Express, and here is my code with a console project:

#include <iostream>

using namespace std;

int main ()

{

cout << "Hello World!";

return 0;

}

and these are the errors I get:

HelloWorld.cpp(1): warning C4627: '#include <iostream>': skipped when looking for precompiled header use

Add directive to 'StdAfx.h' or rebuild precompiled header

HelloWorld.cpp(8): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?

Im going off of this site: http://www.cplusplus.com/files/tutorial.pdf

Comments

  • So, what action do you think is required when you read this message?

    Did you forget to add '#include "StdAfx.h"' to your source?

    I think that is quite clear to me.

    Have fun.

  • The code is correct - it's an IDE configuration problem.

    You need to turn of precompiled headers somehow. Start a new console project and somewhere in the wizard there is probably an option to turn off precompiled headers.

Sign In or Register to comment.