fatal error C1004: unexpected end of file found

zhangweiqiang 2004-01-08 03:07:15
请问如何迅速地找到这个编译错误的原因
fatal error C1004: unexpected end of file found
...全文
1602 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ckp 2004-01-19
  • 打赏
  • 举报
回复
请问如何迅速地找到这个编译错误的原因
fatal error C1004: unexpected end of file found
要解决这个问题很麻烦。
我在编程中碰到的这个提示有以下情况:
1、括号不匹配。(经常是在函数中添加了一段代码,如if,while分句,却忘了在结束时补上一个“}”)
2、在头文件中定义了struct或者class,但是在}之后漏掉了分号。
3、有#if,但是没有#endif。
解决办法:
找出你修改前最后一次能正确运行的源代码。查查看,修改了哪些代码。十有八九是以上的三种情况。
同意huangbeyond(校园人渣)的意见。
bluebohe 2004-01-19
  • 打赏
  • 举报
回复
#include "stdafx.h"
添加在文件的第一句,不行的画就按照楼上方法
iNothing 2004-01-19
  • 打赏
  • 举报
回复
project setting->c/c++->precompiled headers->Not using precompiled headers

yue经帖,maybe ^_^
HongHuer 2004-01-19
  • 打赏
  • 举报
回复
//.cpp

#include "stdafx.h"
carbon107 2004-01-16
  • 打赏
  • 举报
回复
经验+工具
huangbeyond 2004-01-16
  • 打赏
  • 举报
回复
Fatal Error C1004
unexpected end of file found

The compiler reached the end of a source file without resolving a construct.

For instance, a function or structure definition may be missing a closing curly brace, a class definition may be missing a semicolon after its closing brace, a function call or expression may have mismatched parentheses, and so on.

In addition to these common causes, one of the following reasons may have caused this error:

The default disk drive did not contain sufficient space for compiler-generated temporary files. The space required is approximately two times the size of the source file.


An #if directive evaluates to false without a corresponding closing #endif directive.


The precompiled headers option (/Yu) is enabled but the file doesn't contain a hdrstop pragma.


The /Yufilename option is used and the source file being compiled does not contain an #include "filename" directive that uses the same filename used with /Yu.


A source file does not end with a carriage return–linefeed pair.
Tips

Make sure that each opening brace has a matching closing brace.


Make sure that each opening parenthesis has a matching closing parenthesis.


Make sure all class definitions have a semicolon after the closing brace for the class.


When using C-style comments (i.e. /* ... */), make sure there is a closing asterisk-slash ( */ ) combination.
huangbeyond 2004-01-16
  • 打赏
  • 举报
回复
把你的光标移动到"fatal error C1004:"上面,然后按F1,MSDN会自动定位的.

15,976

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧