我是 visual studio 的新手。我创建了一个简单的控制台应用程序,然后选择了一个 c++ 的空项目。
我已经粘贴了代码表格
http://www.cprogramming.com/tutorial/opengl_first_windows_app.html
出现以下错误 错误 C1083:无法打开包含文件:“stdafx.h”:没有这样的文件或目录。
谁能帮我解决这个问题。
我也粘贴了
的代码
http://www.cprogramming.com/tutorial/opengl_windows_programming.html
它让我在 MessageBox 函数中出错。
最佳答案
通过使用合适的项目模板掉入成功的陷阱。即Win32 + Win32 Project,不要勾选属性页上的“Empty project”选项。您将获得 Win32 应用程序的预生成代码,请查看它,因为您可能希望保留其中的一部分。或者干脆删除所有超过 stdafx.h 的 #include 并将其替换为您要尝试的代码。 stdafx.h 文件已经为您预先准备好。
第二个片段可能无法编译,因为代码示例未使用 Unicode 字符串。在字符串字面量前面放一个 L,比如 L"\tHello world".
关于c++ - 错误 C1083 : Cannot open include file: 'stdafx.h' : No such file or directory in VS 2005,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5545641/