我正在使用Eclipse CDT,我之后有一个goto
标签和一个FILE定义,当我编译项目时,它给出了错误:Expression expected before FILE
。
提前致谢, 曼先生
编辑:
好的,这就是我从命令行得到的:
iOS.c: In function ‘main’:
iOS.c:45: error: expected expression before ‘FILE’
iOS.c:49: error: ‘preFile’ undeclared (first use in this function)
iOS.c:49: error: (Each undeclared identifier is reported only once
iOS.c:49: error: for each function it appears in.)`
这就是代码抛出错误的原因:
fileExists:
FILE *preFile = fopen("prefix.txt","r");
答案 0 :(得分:3)
当你在C中编码时,你需要在函数的开头声明变量:
void foo()
{
FILE* preFile;
// some code
fileExists:
preFile = fopen("prefix.txt","r");
}