How to fix C error 'EFAULT undeclared'
Problem:
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;
Solution
Add
#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.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow