大家看看,下面这条错误是什么意思,如何排除:
fatal error C1010: unexpected end of file while looking for precompiled header directive
csdn 的解释:Fatal Error C1010
unexpected end of file while looking for precompiled header directiveA precompiled header was specified, but it did not contain a precompiled header directive.This error can be caused by specifying an incorrect file as a header file, or by specifying an include file with the /Yu (Use Precompiled Header) command line option that is not listed in the source file as an include file.
请尽量详细些,最好把遇到这种情况的可能原因列举一下,谢谢!

解决方案 »

  1.   

    致命错误 C1010在查找预编译头指令时遇到意外的文件结尾用 /Yu 指定的包含文件没有列在源文件中。你是否不小心删除了 #include 语句,而该语句引用了 /Yu 所需的 .h 文件?
      

  2.   

    在cpp文件开始的地方,加上 #include "stdafx.h"
      

  3.   

    是少了在xxx.cpp的开始处少加了 #include "stdafx.h",不是{}不匹配。
      

  4.   

    加入 #include "stdafx.h"  后的确可以通过编译,但是连接的时候又会出现新的问题,例如
    Globals.obj : error LNK2005: _LoadBitmap already defined in Ddutil.obj
    Globals.obj : error LNK2005: _ReLoadBitmap already defined in Ddutil.obj
    Globals.obj : error LNK2005: _CopyBitmap already defined in Ddutil.obj
    所以,我想应该不是缺 #include "stdafx.h" 但是我不知道是缺那个头文件?郁蒙呀!!!!
      

  5.   

    _LoadBitmap ,_ReLoadBitmap ,_CopyBitmap 你看看这几个变量的定义是不是有问题啊
      

  6.   

    就是缺了#include stdafx.h编译器要求任何头文件的第一句必须是#include stdafx.h,这个在设置里面可以更改。关于下面的连接错误,应该是没有增加lib文件或者是因为你的#include文件有交叉,如果需要当成全局用户的话,把它定义再stdafx里面是一个好办法
      

  7.   

    少了预编译头文件,将#include "stdafx.h"添加到***.cpp最前面
      

  8.   

    源文件中,第一个#include 的必须是stdafx.h文件,因为stdafx.h中一般都包含了编译所需要的诸多头文件。
    Globals.obj : error LNK2005: _LoadBitmap already defined in Ddutil.obj
    Globals.obj : error LNK2005: _ReLoadBitmap already defined in Ddutil.obj
    Globals.obj : error LNK2005: _CopyBitmap already defined in Ddutil.obj
    以上问题是某个头文件重复包含所致。查看_LoadBitmap在哪里定义的
      

  9.   

    查查Ddutil头文件,在其中最开始加上
    #ifndef ****(自己定义一个标示符)
    #define ****              
    然后在最后加上#endif
    然后再包含该头文件的文件头处加入:
    #ifndef ****
    #include "(该头文件)"
    #define ****
    #endif
      

  10.   

    #include stdafx.h
    后面连接的时候,重复定义,用#pragma once试试
      

  11.   

    谢谢大家,几经思考后终于解决了,方法共享如下:在FileView里边把错误定义的文件(我的是Ddutil.cpp)删除,重新编译,这条编译错误就排除了!
    然后你会发现external dependencies树下会多出你刚刚删除的Ddutil.cpp和Ddutil.h
      

  12.   

    "编译器要求任何头文件的第一句必须是#include stdafx.h",这个观点是错误的。需要还是不需要stdafx.h,这是项目的属性,可以设置的;不过这个属性缺省是"需要stdafx.h",而且一般没人愿意去改它而已。