Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning: implicit declaration of function 'kill'

Tags:

c

kill

I am making these inclusions:

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

But still getting this warning.

like image 869
Ramy Al Zuhouri Avatar asked Apr 03 '12 13:04

Ramy Al Zuhouri


2 Answers

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

-D_POSIX_C_SOURCE

ex:

-g -D_POSIX_C_SOURCE -Wall -std=c99
like image 72
NUTTAPAT KOONARANGSRI Avatar answered Nov 02 '22 04:11

NUTTAPAT KOONARANGSRI


You are probably passing the "-ansi -Wall" switches to the gcc compiler. You can remove "-ansi" if you don't need it, otherwise try to set the proper feature define macro.

Something like:

#define _POSIX_SOURCE
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#include <sys/wait.h>
like image 27
dAm2K Avatar answered Nov 02 '22 04:11

dAm2K