error C1083: Cannot open include file: 'stdafx.h': No such file or directory in VS 2005

62,937

Solution 1

Fall in the pit of success by using an appropriate project template. Which is Win32 + Win32 Project, don't tick the "Empty project" option on the property page. You'll get pre-generated code for a Win32 application, take a look at it since you might want to keep parts of it. Or just delete it all past the #include for stdafx.h and replace it with the code you want to try. The stdafx.h file is already pre-cooked for you.

The second snippet probably fails to compile because the code sample is not using Unicode strings. Put an L in front of the string literal, like L"\tHello world".

Solution 2

"stdafx.h" is the default name for the precompiled header in Visual Studio.

If you are not using precompiled headers you can omit that include directive.

See this article on Wikipedia for an explanation of precompiled headers.

Share:
62,937

Related videos on Youtube

Abdul Samad
Author by

Abdul Samad

Updated on July 09, 2022

Comments

Related