Linux执行C语言read函数
如果在linux环境下,不做任何处理默认编译含有read函数的c文件,会发现能够成功编译并执行,但是在编译过程中会爆出warning(警告):
test.c:5:5: warning: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
这是因为在编译过程中没有静态导入或者动态加载相关的dll文件引起无法直接编译。 我们可以通过导入相应的库文件(#include<unistd.h>)消除该警告: