I just had this error:
main.c:8: error: implicit declaration of function ‘malloc’
main.c:8: error: incompatible implicit declaration of built-in function ‘malloc’
main.c:14: error: implicit declaration of function ‘printf’
main.c:14: error: incompatible implicit declaration of built-in function ‘printf’
As I had these errors before, I knew that I forgot to add
#include <stdlib.h>
#include <stdio.h>
and a google search would have revealed the missing headers quite soon.
But what would I do, if I had no internet? How would I find the missing header files?
aproposandmanapropos [text]can search through man files, e.g.:Then you can take a look at the man page:
Which reveals that
#include <stdlib.h>is missing.findandgrepIf
aproposdoes not work, like for the following example, you can usefindandgrepto search through all source files:The solution: