编译时出现的warning:
ep-demo.c:16:5: warning: implicit declaration of function ‘mkfifo’ [-Wimplicit-function-declaration]
mkfifo("/tmp/fifo1",0666);
^
ep-demo.c:43:13: warning: implicit declaration of function ‘read’ [-Wimplicit-function-declaration]
read(events[i].data.fd, &c, 1);
^
ep-demo.c:58:5: warning: implicit declaration of function ‘close’ [-Wimplicit-function-declaration]
close(fd1);
^
原因分析:
出现这种现象一般是缺少显式声明。
解决办法:
添加头文件:#include <unistd.h> //for read close
添加头文件:#include <sys/stat.h> //for mkfifo
添加头文件:include<fcntl.h> //for open
参考资料: