Behebung von C-Fehler 'errno undeclared'
English
Deutsch
Problem:
Du hast C-Code wie
main.c
errno = EFAULT;aber wenn du versuchst, es zu kompilieren, siehst du eine Fehlermeldung wie
error_message.txt
main.c: In function ‘main’:
main.c:4:5: error: ‘errno’ undeclared (first use in this function)
errno = EFAULT;
^~~~~
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;Lösung
Add
errno_include.c
#include <errno.h>am Anfang der Quelldatei, wo der Fehler aufgetreten ist. Dies wird sowohl die errno-Variable als auch spezifische Fehlercodes wie EFAULT einschließen.
Check out similar posts by category:
C/C++, GCC Errors
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow