编译错误解决:implicit declaration of function 'close' is invalid in C99

2017/06/02 program 共 271 字,约 1 分钟

编译错误

error:
      implicit declaration of function 'close' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        close(tfd);
        ^
1 error generated.

解决方案

在出错的这个文件中添加头文件包含:

#include <fcntl.h> // for open
#include <unistd.h> // for close

参考:

c - Implicit declaration of function ‘close’ - Stack Overflow

文档信息

Search

    Table of Contents