How to fix C error ‘EFAULT undeclared’


You have C code like

errno = EFAULT;

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

main.c:4:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:13: error: ‘EFAULT’ undeclared (first use in this function)
     errno = EFAULT;



#include <errno.h>

at the top of the source file where the error occured. This will include both error codes like EFAULT and the global errno variable itself.