c - 未声明的标识符 - 不确定为什么

标签 c undeclared-identifier

刚学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;
}

但是我在尝试编译时遇到了这些错误:
错误 C2065:“FILE”:未声明的标识符
错误 C2065:“fp”:未声明的标识符
警告 C4552:“*”:运算符无效;具有副作用的预期运算符

我不确定为什么我相信 FILE 是 C 中的有效标识符

我正在使用 VS2012 的 Developer Command Prompt 进行编译

最佳答案

FILE is declared in stdio.h .添加#include <stdio.h>到文件的顶部。

关于c - 未声明的标识符 - 不确定为什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39041040/

相关文章:

c++ - 在 iPhone 上浏览源代码

c - vsnprintf 和 strerror : segmentfault?

c++ - 为什么下面的语句不起作用?

c - 如何知道 .so 库文件中的函数以及如何将特定的二进制代码链接到您的代码中?

c++ - 具有所有权利的未声明标识符包括

c++ - 过剩库中缺少 glutInitContextVersion()

C++ 'ClassName Not Declared' 错误

c - 堆栈粉碎检测到STM32f7