简体   繁体   中英

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

I am new to visual studio.I have created a simple console application and then selected an empty project of c++. I have pasted the code form
http://www.cprogramming.com/tutorial/opengl_first_windows_app.html

it is giving the following error error C1083: Cannot open include file: 'stdafx.h': No such file or directory.

Can any body help me how ti solve that issue.

Also i have pasted the code from
http://www.cprogramming.com/tutorial/opengl_windows_programming.html

and it gives me error in MessageBox function.

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".

"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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM