静态声明'close'遵循非静态声明static inline int close(int sock)

问题描述 投票:1回答:1

我一直在用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
c zephyr-rtos
1个回答
2
投票

正如user3386109所述,close是一个C POSIX库函数,用于关闭文件描述符。你可以在这里找到更多相关信息: -

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

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

© www.soinside.com 2019 - 2024. All rights reserved.