fatal error C1010: unexpected end of file while looking for precompiled header directive
错误原因是什么?

解决方案 »

  1.   

    有加
    #include "StdAfx.h"?
      

  2.   

    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)
      

  3.   

    缺省情况下,Visual studio 中的 .cpp 文件的第一行一般应当是 #include "stdafx.h";如果你不是新手,另外谈。
      

  4.   

    http://blog.csdn.net/ziren235/archive/2006/12/04/1428869.aspx
      

  5.   

    #include   "stdafx.h "
    Rebuild All一下
      

  6.   

    在所有的.cpp文件前面加上 #include "StdAfx.h"