implicit declaration of function ‘***’原因分析

编译时出现的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      //for read close

添加头文件:#include    //for mkfifo

添加头文件:include           //for open 

参考资料:https://blog.csdn.net/linbe_ice/article/details/1498972

                 https://blog.csdn.net/asmcvc/article/details/72847011

转载请注明出处:https://blog.csdn.net/hzqgangtiexia/article/details/80297734

你可能感兴趣的:(★环境搭建与常见错误集锦)