我正在尝试构建我的库,但 libevent 中名为 evutil.c 的文件给我带来了困难。
libevent/evutil.c:错误:函数“pipe2”的隐式声明在 C99 中无效
涉及的代码为:
if (pipe2(fd, O_NONBLOCK|O_CLOEXEC) == 0)
return 0;
我现在无法将代码更新到 c11。 我应该如何更改代码才能不再出现此错误?
最佳答案
这不是 C99 问题。您需要包含 pipe2
的 header 。 According to the pipe2 manual那是unistd.h
。
为什么 libevent 本身不这样做是一个有效的问题。
关于c - 如何修复 'implicit declaration of function ' 管道 2' is invalid in C99',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55385607/