How to fix C error ‘stderr undeclared’

Problem:

You have C code like

fprintf(stderr, "test");

but when you try to compile it you see an error message like

/home/uli/myproject/main.c:9:25: error: ‘stderr’ undeclared (first use in this function)
                 fprintf(stderr, "test");

Solution:

Add

#include <stdio.h>

at the top of the source file where the error occured. Including stdio.h will include symbols like printf, fprintf, stdin, stdout and stderr.