未声明的标识符 - 不确定为什么
undeclared identifier - unsure as to why
我刚学C
我写了以下内容:
void main(void)
{
unsigned int curr_dat = 0; // The current dat file to use
unsigned char ch = 0; // Key entered at keyboard
unsigned char lastkey = 0; // Last key entered (movement command)
FILE *fp;
}
但是我在尝试编译时遇到了这些错误:
error C2065: 'FILE' : undeclared identifier
error C2065: 'fp' : undeclared identifier
warning C4552: '*' : operator has no effect; expected operator with side-effect
我不确定为什么我认为 FILE
是 C
中的有效标识符
我正在使用 VS2012 的开发人员命令提示符进行编译
FILE
is declared in stdio.h
。将 #include <stdio.h>
添加到文件顶部。
FILE
是 stdio.h
的类型。要使用它,您必须添加:
#include <stdio.h>
在文件的顶部。结果可以是:
#include <stdio.h>
void main(void) {
unsigned int curr_dat = 0; // The current dat file to use
unsigned char ch = 0; // Key entered at keyboard
unsigned char lastkey = 0; // Last key entered (movement command)
FILE *fp;
}
我刚学C
我写了以下内容:
void main(void)
{
unsigned int curr_dat = 0; // The current dat file to use
unsigned char ch = 0; // Key entered at keyboard
unsigned char lastkey = 0; // Last key entered (movement command)
FILE *fp;
}
但是我在尝试编译时遇到了这些错误:
error C2065: 'FILE' : undeclared identifier
error C2065: 'fp' : undeclared identifier
warning C4552: '*' : operator has no effect; expected operator with side-effect
我不确定为什么我认为 FILE
是 C
我正在使用 VS2012 的开发人员命令提示符进行编译
FILE
is declared in stdio.h
。将 #include <stdio.h>
添加到文件顶部。
FILE
是 stdio.h
的类型。要使用它,您必须添加:
#include <stdio.h>
在文件的顶部。结果可以是:
#include <stdio.h>
void main(void) {
unsigned int curr_dat = 0; // The current dat file to use
unsigned char ch = 0; // Key entered at keyboard
unsigned char lastkey = 0; // Last key entered (movement command)
FILE *fp;
}