Error Message
unexpected end of file while looking for precompiled header. Did you forget to add '#include name' to your source?
http://msdn.microsoft.com/en-us/library/d7fz9ckx(VS.80).aspx 写道
Error Message
unexpected end of file while looking for precompiled header. Did you forget to add '#include name' to your source?
An include file specified with /Yu is not listed in the source file. This option is enabled by default in most Visual C++ Project types and "stdafx.h" is the default include file specified by this option.
In the Visual Studio environment, use one of the following methods to resolve this error:
If you do not use precompiled headers in your project, set the Create/Use Precompiled Header property of source files to Not Using Precompiled Headers. To set this compiler option, follow these steps:
*In the Solution Explorer pane of the project, right-click the project name, and then click Properties.
*In the left pane, click the C/C++ folder.
*Click the Precompiled Headers node.
*In the right pane, click Create/Use Precompiled Header, and then click Not Using Precompiled Headers.
Make sure you have not inadvertently deleted, renamed or removed header file (by default, stdafx.h) from the current project. This file also needs to be included before any other code in your source files using #include "stdafx.h". (This header file is specified as Create/Use PCH Through File project property)
两种解决方法:
工程上点击右键,选择property->c/c++->precompiled headers,选择not using precompiled headers即可。
或者加上 #include "stdafx.h"
stdafx.h
名称的英文全称为:Standard Application Framework Extensions
所谓头文件预编译,就是把一个工程(Project)中使用的一些MFC标准头文件(如Windows.H、Afxwin.H)预先编译,以后该工程编译时,不再编译这部分头文件,仅仅使用预编译的结果。这样可以加快编译速度,节省时间。
预编译头文件通过编译stdafx.cpp生成,以工程名命名,由于预编译的头文件的后缀是“pch”,所以编译结果文件是projectname.pch。(如果设置了not using precompiled headers那么工程的debug目录下就没有.pch文件。)
因此,所有的MFC实现文件第一条语句都是:#include "stdafx.h"。
http://baike.baidu.com/view/1344257.htm 写道
通俗一点说:
当我们使用AppWizard来自动生成某些项目的时候,系统会自动把所需要include的头文件在stdafx.h中先include一下,这样,我们只需要直接include这个stdafx.h文件即可.因为同一个项目中的不同源文件CPP都包含相同的include文件,这样,为每个.CPP文件都重复include这些文件就显得很傻了。当然如果你不用MFC的话就不用了。即:在每个.cpp文件中都include stdafx.h 就相当于包含了其他的如iostream.h等文件.
- 大小: 96.5 KB
分享到:
相关推荐
解决报错fatal error C1010 unexpected end of file while looking for precompiled header directive
最常见的20种VC++错误,比如:1、fatal error C1010: unexpected end of file while looking for precompiled header directive。 寻找预编译头文件路径时遇到了不该遇到的文件尾。(一般是没有#include "stdafx.h...
1、fatal error C1010: unexpected end of file while looking for precompiled header directive。 寻找预编译头文件路径时遇到了不该遇到的文件尾。(一般是没有#include "stdafx.h") 2、fatal error C1083: ...
1、fatal error C1010: unexpected end of file while looking for precompiled header directive。 寻找预编译头文件路径时遇到了不该遇到的文件尾。(一般是没有#include "stdafx.h") 2、fatal error C1083: ...
1、fatal error C1010: unexpected end of file while looking for precompiled header directive。 寻找预编译头文件路径时遇到了不该遇到的文件尾。(一般是没有#include "stdafx.h")
网友分享的能够解决fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory问题的程序。MySQL-python-1.2.3.win32-py2.7.exe-32位MySQL-python-1.2.3.win-amd64-py...
fatal error C1083: 无法打开包括文件:“stdint.h”: No such file or directory. stdint.h是c99标准的头文件,vc不支持,所以肯定会提示“No such file or directory”的。
fatal error C1083: 无法打开包括文件:“stdint.h”: No such file or directory. stdint.h是c99标准的头文件,vc不支持,所以肯定会提示“No such file or directory”的。使用方法:下载压缩包,解压得到两个.h...
在VS2008中,经常会遇到“fatal error C1083: 无法打开包括文件:“afxcontrolbars.h””这样的问题,该文档提供了一个解决方案。
fatal error C1083: Cannot open include file: 'io.h': No such file or directory
对于 fatal error LNK1123: failure during conversion to COFF错误,网上很多都是说把什么“是”改成“否”,其实都是治标不治本。这里有个链接,让你清楚知道为啥出错,怎么解决。记得保留哦~
error C1083: 无法打开包括文件:“pthread.h”: No such file or directory cocos2d-x-2.1.5\extensions\AssetsManager\AssetsManager.h 30 1 AssetsManagerTest
下载该文件后,分别将glaux.h、glaux.dll、glaux.lib拷贝到VS2013的安装目录即:VS2013/VC/lib ; VS2013/VC/bin ; VS2013/VC/include/GL中,重新编译即可。
winpcap 4.1.1在vc6下编译会出现以下错误,原因是vc6.0并不完美支持c++99标准,在64位cpu中...' before type 'unsigned int' c:\wpdpack\include\pcap-stdinc.h(79) : fatal error C1004: unexpected end of file found
完美解决VS2003.Net fatal error LNK1201: 写入程序数据库“.pdb”时出错 文末给出一个完美的解决方案和一个懒人补丁包。问题描述如下:在重新编译的时候,经常报错: fatal error LNK1201: 写入程序数据库“.pdb”...
fatal error: boostdesc_bgm.i: No such file or directory补充文件
fatal error C1010: unexpected end of file while looking for precompiled header directive Generating Code... 2)如果你把pch文件不小心丢了,编译的时候就会产生很多的不正常的行为。根据以上 的分析,你只要...
解决安装vs2012后vs2010 LINK : fatal error LNK1123: failure during conversion to COFF Wrong version: 03/18/2010 01:16 PM 31,048 cvtres.exe Correct version: 02/21/2011 06:03 PM 31,056 cvtres.exe
在使用VC编程中,为了加快编译,vc编译器提供了预编译...因此,有时总会出现忘记写这个的事情,这时候编译器就会报一个错误: 代码如下:Error 1 fatal error C1010: unexpected end of file while looking for precom