具体错误:
builds/unix/ftsystem.c:325:22: error: implicit declaration of function 'read' [-Werror,-Wimplicit-function-declaration] read_count = read( file, ^ builds/unix/ftsystem.c:325:22: note: did you mean 'fread'? /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:158:9: note: 'fread' declared here size_t fread(void * __restrict __ptr, size_t __size, size_t __nitems, ... ^ builds/unix/ftsystem.c:346:5: error: implicit declaration of function 'close' [-Werror,-Wimplicit-function-declaration] close( file );
解决办法:
说到底就是没有包含相应的头文件:
#include <fcntl.h> #include <unistd.h>