Warning: implicit declaration of the 'kill' function

I do these inclusions:

#include <signal.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> 

But still getting this warning.

+6
source share
2 answers

You are probably passing the "-ansi -Wall" switches to the gcc compiler. You can remove "-ansi" if you do not need it, otherwise try setting the appropriate function definition macro.

Sort of:

 #define _POSIX_SOURCE #include <sys/types.h> #include <signal.h> #include <unistd.h> #include <sys/wait.h> 
+8
source

You can also define it at compile time by adding this flag with gcc.

 -D_POSIX_C_SOURCE 

Example:

 -g -D_POSIX_C_SOURCE -Wall -std=c99 
+1
source

Source: https://habr.com/ru/post/912319/


All Articles