fatal error C1004unexpected end of file found

当编译器在源文件中遇到未解决的构造时,可能会出现致命错误C1004,例如缺失的括号、大括号或分号。此外,可能是磁盘空间不足、预编译头选项问题或文件缺少换行符对。检查并确保每个开括号都有对应的闭括号,每个函数调用和表达式都有正确匹配的括号,类定义结束时有分号。
msdn 里关于error C1004的描述如 929 说的.
我想最大的可能还是类和结构定义的右括号"}"后少了“;”

着重检查头文件.若有问题的头文件在多处被包含了,可能多处出错.

而 msdn 里关于 error C1004 的描述 还有使用了特殊编译伪指令的情况,请查msdn


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.
意外的文件结尾处找到
编译器达到一个源文件的结尾不解决的构建体。
例如,一个功能或结构定义可能缺少右大括号,一类定义可能会闭幕括号后丢失分号,函数调用或表达可能有不匹配的括号,并依此类推。
除了这些常见的原因,有下列原因之一,可能导致此错误:
默认的磁盘驱动器不包含编译器生成的临时文件足够的空间。所需的空间是源文件的大小约两倍。


一个#if指令计算结果为false没有相应的收盘#endif指令。


预编译头选项(/羽)已启用,但该文件不包含hdrstop后面附注。


在/ Yufilename选项用于和源文件被编译不包含使用带有/于使用相同的文件名的的#include“文件名”指令。


源文件不以回车换行符对端。
提示
确保每个左括号有一个匹配的右括号。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值