关于"Can't find..."*.pch"或"stdafx.h"的解决方法
2013-01-31 10:37
956 查看
这时因为该模块没有包括预编译头文件“stdafx.h”的缘故。
VC用一个stdafx.cpp包含头文件stdafx.h,然后在stdafx.h里包含大部分系统头文件,这
样编译时VC就通过编译stdafx.cpp把大部分系统头文件预编译进来了,在Debug目录下有
一个很大的文件.pch,这里就存储了预编译信息。
根据这个原理,如果这个pch损坏了或被删除了,系统重新编译时就会抱怨“cannot open
precompiled header file debug/.pch”。这时怎么解决这个问题呢,打开Project-》
Setting对话框选C++页,将Category下拉式列表框选中Precompiled Headers,最简单的
办法就是选中第一个选项“Not using….”,这样就根本不用预编译头也不去寻找pch文件,
就不会出错了,但是这样做的后果是每次编译、连接都化更多的时间。
也可以选第二个选项”Automatic …”,然后在“Through header”力填上stdafx.h,这样
如果没有pch文件系统会自动生成一个pch,如果有的话就使用这个pch,这个选项是比较“
智能”的。
第三个选项是强行创建一个pch文件,第四个选项是直接使用pch文件。当然“Through
headers”里都填stdafx.h了
上文复制于http://blog.sina.com.cn/s/blog_4dcea0a701000axk.html
VC用一个stdafx.cpp包含头文件stdafx.h,然后在stdafx.h里包含大部分系统头文件,这
样编译时VC就通过编译stdafx.cpp把大部分系统头文件预编译进来了,在Debug目录下有
一个很大的文件.pch,这里就存储了预编译信息。
根据这个原理,如果这个pch损坏了或被删除了,系统重新编译时就会抱怨“cannot open
precompiled header file debug/.pch”。这时怎么解决这个问题呢,打开Project-》
Setting对话框选C++页,将Category下拉式列表框选中Precompiled Headers,最简单的
办法就是选中第一个选项“Not using….”,这样就根本不用预编译头也不去寻找pch文件,
就不会出错了,但是这样做的后果是每次编译、连接都化更多的时间。
也可以选第二个选项”Automatic …”,然后在“Through header”力填上stdafx.h,这样
如果没有pch文件系统会自动生成一个pch,如果有的话就使用这个pch,这个选项是比较“
智能”的。
第三个选项是强行创建一个pch文件,第四个选项是直接使用pch文件。当然“Through
headers”里都填stdafx.h了
上文复制于http://blog.sina.com.cn/s/blog_4dcea0a701000axk.html
相关文章推荐
- 关于Ubunt 10.04.3(32位)出现"waiting for sound system to respond"的解决方法
- 关于codeblocks出现can't find compiler的解决方法
- 关于 can not find hdf5.h(hdf5:没有那个文件或目录)的解决方法
- Idea golang "can’t find import" 解决方法
- "it could not find or load the Qt platform plugin "windows""解决方法
- 关于"[MYSQL ERROR(2006):MySQL server has gone away]"的解决方法
- eclipse关于"/struts-tags" not found错误的最新解决方法
- 关于JCreator在编译程序时出现的"Error:Invalid path"问题的解决方法
- 关于使用Git的时候出现"HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large"的解决方法
- 关于"Slidepage传值问题"的解决方法
- 关于Android4.0 emulator-arm.exe-应用程序错误,内存不能为"read"问题解决方法
- 【转】关于Android4.0 emulator-arm.exe-应用程序错误,内存不能为"read"问题解决方法
- Can not find the tag library descriptor for "http://www.springframework.org/tags/form" 解决方法
- 关于Error 1 error C1189: #error : "include 'stdafx.h' before including this file这个错误的解决方法
- 关于Android4.0 emulator-arm.exe-应用程序错误,内存不能为"read"问题解决方法
- 关于svn出现"上次提交后没有更改或添加的文件"的解决方法
- 执行gulp serve时throw err: can not find module "xxx"解决方法
- 关于vs2013 安装后出现"Cannot find one of more components. Please reinstall the application"处理方法
- 【转】关于Android4.0 emulator-arm.exe-应用程序错误,内存不能为"read"问题解决方法
- 关于heritrix安装配置时出现"必须限制口令文件读取访问权限"的解决方法