tempad
Readygo技术搜索引擎 >>PHP技术 >> 请问我这代码有什么问题?老是报什么错!!!!

请问我这代码有什么问题?老是报什么错!!!!

Readygo技术搜索引擎 网络搜索 efish 2008-1-14 16:10:25

请问我这代码有什么问题?老是报什么错!!!!

楼主imissyoulipj(天涯浪子)2002-07-20 11:05:32 在 VC/MFC / 基础类 提问

老是报什么“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   >   1000  
   
  class   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;  
  }  
   
  问题点数:0、回复次数:12Top

1 楼rick29(rick.z)回复于 2002-07-20 11:07:47 得分 0

是不是你最后一个函数少打了一个“{”??反正从你贴出来的东西看来,是这么回事...  
  Top

2 楼zhatin()回复于 2002-07-20 11:09:36 得分 0

#include   "stdafx.h"Top

3 楼imissyoulipj(天涯浪子)回复于 2002-07-20 11:11:18 得分 0

没有哦Top

4 楼heartliubin(bin)回复于 2002-07-20 11:11:54 得分 0

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

5 楼imissyoulipj(天涯浪子)回复于 2002-07-20 11:14:40 得分 0

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

6 楼xnliu(傻子)回复于 2002-07-20 11:16:40 得分 0

我把你的这段代码全份不动的考下来,编译能通过,没有错误呀。  
  你再检查是不是其他地方错了。Top

7 楼xnliu(傻子)回复于 2002-07-20 11:17:12 得分 0

我把你的这段代码全份不动的考下来,编译能通过,没有错误呀。  
  你再检查是不是其他地方错了。Top

8 楼imissyoulipj(天涯浪子)回复于 2002-07-20 11:20:17 得分 0

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

9 楼xnliu(傻子)回复于 2002-07-20 11:21:05 得分 0

有可能真是你什么地方设置出错了,我建议你重新建个工程,只把这个类加进去,试试。Top

10 楼rick29(rick.z)回复于 2002-07-20 11:21:09 得分 0

咦,我的显示器出毛病了,怎么刚才少了一个“{”...   丢脸了...Top

11 楼imissyoulipj(天涯浪子)回复于 2002-07-20 11:25:14 得分 0

我把这段代码拷贝到一个新建的基于对话框的工程中调试,还是一样的错误Top

12 楼zhuojohn(闲云野鹤)回复于 2002-07-20 12:03:43 得分 0

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!  
  Top

13 楼imissyoulipj(天涯浪子)回复于 2002-07-20 13:48:23 得分 0

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

责任编辑: efish 参与评论 查找更多:
相关文章
关于自定义函数的应用? 关于自定义函数的应用?
关于盗版Turbo C++3.0的安装问题 关于盗版Turbo C++3.0的安装问题
数据库与程序连接错误?(在线等待) 数据库与程序连接错误?(在线等待)
怎样把dotnetfx做到安装程序里? 怎样把dotnetfx做到安装程序里?
不知CMOS密码又不想清除原有的密码能进入吗? 不知CMOS密码又不想清除原有的密码能进入吗?
vb.net可以在哪些操作系统下运行? vb.net可以在哪些操作系统下运行?
oracle not available的问题! oracle not available的问题!
为什么我用c#的安装向导做安装程序,还会出现一个什… 为什么我用c#的安装向导做安装程序,还会出现一个什么“无法恢复的错误!”
有些控件报是For Delphi4的,在Delphi5下安装会出现… 有些控件报是For Delphi4的,在Delphi5下安装会出现"找不到运行此程序的某个库文件."有没有什么办法解决这个问题?
如何实现将两个字段的数据以“a*b”形式现实? 如何实现将两个字段的数据以“a*b”形式现实?
2秒记住本站域名

玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的readygo.com.cn

分类导航
Readygo技术搜索引擎