老是报什么“fatal error C1010: unexpected end of file while looking for precompiled header directive”
编译不过去,谢谢!!!
// SuperString.h: interface for the CSuperString class.
//
//////////////////////////////////////////////////////////////////////#if !defined(AFX_SUPERSTRING_H__40E1AADD_2EB5_4909_BBE5_127BA4A00F42__INCLUDED_)
#define AFX_SUPERSTRING_H__40E1AADD_2EB5_4909_BBE5_127BA4A00F42__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000class CSuperString  
{
public:
CSuperString(CString strLine);
void Split();
virtual ~CSuperString();
private:
CString pStr;
};#endif // !defined(AFX_SUPERSTRING_H__40E1AADD_2EB5_4909_BBE5_127BA4A00F42__INCLUDED_)//////////////////////////////////////////////////////////////////////
// SuperString.cpp: implementation of the CSuperString class.
//
//////////////////////////////////////////////////////////////////////#include "SuperString.h"//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////CSuperString::CSuperString(CString strLine)
{
pStr=strLine;
return;
}void CSuperString::Split()
{
return;
}
CSuperString::~CSuperString()
{
return;
}

解决方案 »

  1.   

    这段代码是寻找预编译头文件stdafx.h
    可以project菜单的setting项中C/C++,category下拉列表矿种的procompile headers中设定预编译头文件模式。自己在看一看吧
      

  2.   

    本来错误是一个的,加了#include "stdafx.h"后变成了5个错误,还有警号
      

  3.   

    我只编译这一段代码,可是老是报错,错误显示在.cpp文件的最后面
    我按照heartliubin(bin) 说得这段代码是寻找预编译头文件stdafx.h
    可以project菜单的setting项中C/C++,category下拉列表矿种的procompile headers中设定预编译头文件模式。自己在看一看吧还是不行
      

  4.   

    If, while building an MFC application, you receive the error message "fatal error C1010: unexpected end of file while looking for precompiled header directive" it means you have run afoul of the compiler's handling of precompiled headers.What are precompiled headers?
    MFC programs use many libraries, requiring the use of many header files. To save time, the compiler tries to precompile most of these header files, and use the predigested data instead of reading through all of these header files on every compilation. There are a number of ways to do this. The standard method for MFC programs is to lump all of these common header file references into one header file ("stdafx.h"). If you just have to ask what "stdafx" means, it comes from the early name of MFC, which was AFX (application framework).When compiling each source (.cpp) file, the compiler skips through the source code, looking for the directive:#include "stdafx.h"Once it finds this directive, it substitutes the precompiled header information and then begins compiling the rest of the file. If your source file doesn't contain this directive, you get the C1010 error described above.Fixing the problem
    There are two ways to get rid of the error, depending on the file you are trying to compile:The direct solution is to add the include directive to your source file, before any other library references or other code. This solution is appropriate when the module you are compiling needs to make use of MFC classes (e.g., CString). 
    If your module is "pure" C++ code (for example, your own "Date" class), with no need to reference MFC at all, then you may prefer not to add the "stdafx.h" include directive. In this case, you can change the project settings to inform MSVC that you are not making use of the precompiled header files. Here's how to do it:
    From the Project menu, select Settings .... 
    Make sure the Settings for selection reflects the project you are building. By default, this will likely be "Win32 Debug". 
    Expand the Source Files folder in the list on the left, and click once on the source file that you don't want to use precompiled headers. 
    On the right, select the C/C++ tab. 
    In the Category combo box, select Precompiled headers. 
    Select the Not using precompiled headers option. 
    Repeat for any other files for which you wish to disable precompiled headers (but not for any files created by the Developer Studio AppWizard). 
    Click OK to close the project settings dialog. 1、在源文件树上,选择SuperString.cpp
    2、选择: 工程--设置--C/C++-Category;在下拉菜单中选择Procomplied  Headers中,选择Not Using PreCompiled headers
    3、在SuperString.h中,加入#include "stdafx.h"
    4、重新编译,OK!
      

  5.   

    找到问题了,在.h文件中的前面部分改成下面的就行了。谢谢#include "stdafx.h"
    #include "ETalk.h"
    #include "CSuperString.h"#ifdef _DEBUG
    #undef THIS_FILE
    static char THIS_FILE[]=__FILE__;
    #define new DEBUG_NEW
    #endif