错误 C1083:无法打开包含文件:'stdafx.h':VS 2005 中没有这样的文件或目录 [英] error C1083: Cannot open include file: 'stdafx.h': No such file or directory in VS 2005
问题描述
我是 Visual Studio 的新手.我创建了一个简单的控制台应用程序,然后选择了一个空的 c++ 项目.我已经粘贴了代码表单
http://www.cprogramming.com/tutorial/opengl_first_windows_app.html
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
它给出了以下错误错误 C1083:无法打开包含文件:stdafx.h":没有这样的文件或目录.
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.
我也粘贴了
的代码http://www.cprogramming.com/tutorial/opengl_windows_programming.html
它在 MessageBox 函数中给了我错误.
and it gives me error in MessageBox function.
推荐答案
使用合适的项目模板陷入成功的陷阱.Win32+Win32项目,属性页的空项目"选项不要打勾.您将获得 Win32 应用程序的预生成代码,请查看它,因为您可能希望保留其中的一部分.或者只是删除所有超过 stdafx.h 的 #include 并将其替换为您想要尝试的代码.stdafx.h 文件已经为您准备好了.
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.
第二个片段可能无法编译,因为代码示例未使用 Unicode 字符串.在字符串字面量前面放一个 L,例如 L"\tHello world".
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".
这篇关于错误 C1083:无法打开包含文件:'stdafx.h':VS 2005 中没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!