I'm working with some embedded C code for an LCD display in which one of the files includes stdio.h
and defines fputc
, fgetc
, and ferror
. fputc
calls the LCD driver code to print a character to the screen, but the other two don't actually do anything interesting.
Whenever I try to compile the project I get the following error:
src/ST7735.c:1578:5: error: expected identifier or '(' before 'int' 1578 | int ferror(FILE *f){
src/ST7735.c:1578:5: error: expected ')' before '(' token 1578 | int ferror(FILE *f){
The error goes away if I rename ferror
to anything else. The other two functions don't create any issues. I also found that if I do rename the function but call ferror
elsewhere in the code, the project still compiles, when I'd expect linking to fail without a definition for ferror
anywhere else in the project.
I'm using the arm-none-eabi toolchain with the -nostdlib
flag, but the project was originally created using Keil. I'm not sure if that is part of the explanation. I searched Google for any relevant information but couldn't find anything. Is there something special about ferror
in GCC?