Search code examples
filecompiler-errorsstderriar

Error[Pe020]: identifier "FILE" is undefined in IAR Workbench


// 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 

}

As per above code I got an two Errors :

1) "Error[Pe020]: identifier "FILE" is undefined"

when I found stdlib.h then there are no any kind of "FILE" directive define or typedef. So,please tell me which changes needed in stdlib.h or stdio.h

2) Error[Pe020]: identifier "stderr" is undefined

So,In which header file stderr define ?

Please tell me How to solve above errors ?

Thanks in advance.


Solution

  • First, FILE is in stdio.h not in stdlib.h. Second, the default library does not include FILE support since this feature uses a lot of space and is seldom needed in embedded systems. To use FILE you must switch to full libraries in the configuration dialog (if you use the IDE) or by using the command line switch --dlib full (if you use the compiler from the command line).

    Note that the full library is much larger than the normal library so if the only use of FILE is to print diagnostic messages to stderr I suggest that you use some other way of presenting the messages.