错误[Pe020]:标识符";文件";在IAR工作台中未定义 //预处理器指令在格式中提及: #包括“stdio.h” #包括“stdlib.h” #包括“math.h” #包括“string.h” #包括“限制.h” #包括“stddef.h” #包括“stdint.h” ... int main() { FILE*fin,*fout;//错误[Pe020]:标识符“FILE”未定义 ... ... ... fprintf(stderr,“%s\n”,opus\u get\u version\u string()); //错误[Pe020]:标识符“stderr”未定义 }

错误[Pe020]:标识符";文件";在IAR工作台中未定义 //预处理器指令在格式中提及: #包括“stdio.h” #包括“stdlib.h” #包括“math.h” #包括“string.h” #包括“限制.h” #包括“stddef.h” #包括“stdint.h” ... int main() { FILE*fin,*fout;//错误[Pe020]:标识符“FILE”未定义 ... ... ... fprintf(stderr,“%s\n”,opus\u get\u version\u string()); //错误[Pe020]:标识符“stderr”未定义 },file,compiler-errors,stderr,iar,File,Compiler Errors,Stderr,Iar,根据上述代码,我得到了两个错误: 1) “错误[Pe020]:标识符“文件”未定义” 当我找到stdlib.h时,没有任何类型的“FILE”指令define或typedef。 所以,请告诉我stdlib.h或stdio.h需要哪些更改 2) 错误[Pe020]:标识符“stderr”未定义 那么,stderr在哪个头文件中定义 请告诉我如何解决上述错误 提前感谢。首先,文件在stdio.h中,而不是stdlib.h中。其次,默认库不包括文件支持,因为此功能占用大量空间,并且在嵌入式系统中很少需要

根据上述代码,我得到了两个错误:

1) “错误[Pe020]:标识符“文件”未定义”

当我找到stdlib.h时,没有任何类型的“FILE”指令define或typedef。 所以,请告诉我stdlib.h或stdio.h需要哪些更改

2) 错误[Pe020]:标识符“stderr”未定义

那么,stderr在哪个头文件中定义

请告诉我如何解决上述错误


提前感谢。

首先,
文件在
stdio.h
中,而不是
stdlib.h
中。其次,默认库不包括
文件
支持,因为此功能占用大量空间,并且在嵌入式系统中很少需要。要使用
文件
,必须在“配置”对话框中切换到完整库(如果使用IDE),或者使用命令行开关--dlib full
(如果从命令行使用编译器)


请注意,完整库比普通库大得多,因此,如果
文件的唯一用途是将诊断消息打印到
stderr
中,我建议您使用其他方式显示消息。

在IDE中:项目选项>常规选项>库配置>库>完整
// Preprocessor directive mention in <> formate :
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "string.h"
#include "limits.h"
#include "stddef.h"
#include "stdint.h"
...
int main()
{
 FILE *fin, *fout;  //Error[Pe020]: identifier "FILE" is undefined
 ...
 ...
 ...
 fprintf(stderr, "%s\n", opus_get_version_string());              
                         //Error[Pe020]: identifier "stderr" is undefined 

}