gpt4 book ai didi

c - ‘close’ 的静态声明遵循非静态声明 static inline int close(int sock)

转载 作者:太空宇宙 更新时间:2023-11-04 02:23:01 24 4
gpt4 key购买 nike

我已经用 c 语言进行了大约 6 个月的开发,我对这里发生的事情感到非常困惑。尝试包含 socket.h 头文件时出现此错误。

static inline int close(int sock)
{
return zsock_close(sock);
}

这是它似乎有问题的方法?我从构建中取回了这个。

In file included from /home/jordan/zephyr/zephyr/include/posix/pthread.h:13:0,
from /home/jordan/thrift/src/c/zephyr/mbedtlstest/../../../../include/thrift/os.h:10,
from /home/jordan/thrift/src/c/zephyr/mbedtlstest/../../../../include/thrift/types.h:4,
from /home/jordan/thrift/src/c/zephyr/mbedtlstest/../../../../include/thrift/ssl/../transport.h:4,
from /home/jordan/thrift/src/c/zephyr/mbedtlstest/../../../../include/thrift/ssl/transport.h:4,
from /home/jordan/thrift/src/c/ssl/transport.c:1:
/home/jordan/zephyr/zephyr/include/posix/unistd.h:21:12: note: previous declaration of ‘close’ was here

最佳答案

正如 user3386109 所述,close 是一个 C POSIX 库函数,用于关闭文件描述符。您可以在此处找到有关它的更多信息:-

https://linux.die.net/man/2/close

解决此问题的正确方法是将您的函数重命名为以前未使用过的唯一名称。

关于c - ‘close’ 的静态声明遵循非静态声明 static inline int close(int sock),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55173100/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com