错误:函数类型在ISO C中不真正兼容[-Werror=pedantic]

错误:函数类型在ISO C中不真正兼容[-Werror=pedantic],c,gcc,C,Gcc,当我尝试使用gcc编译包含“sgx lib.h”头文件的C源代码时,它会弹出以下错误: In file included from src/trusted/service_runtime/nacl_test_injection_main.c:9:0: src/trusted/service_runtime/opensgx/libsgx/include/sgx-lib.h:94:42: error: function types not truly compatible in ISO C [-W

当我尝试使用gcc编译包含“sgx lib.h”头文件的C源代码时,它会弹出以下错误:

 In file included from src/trusted/service_runtime/nacl_test_injection_main.c:9:0:
src/trusted/service_runtime/opensgx/libsgx/include/sgx-lib.h:94:42: error: function types not truly compatible in ISO C [-Werror=pedantic]
 extern int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
                                          ^
src/trusted/service_runtime/opensgx/libsgx/include/sgx-lib.h:94:42: error: function types not truly compatible in ISO C [-Werror=pedantic]
src/trusted/service_runtime/opensgx/libsgx/include/sgx-lib.h:96:38: error: function types not truly compatible in ISO C [-Werror=pedantic]
 extern int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
                                      ^
src/trusted/service_runtime/opensgx/libsgx/include/sgx-lib.h:96:38: error: function types not truly compatible in ISO C [-Werror=pedantic]
src/trusted/service_runtime/opensgx/libsgx/include/sgx-lib.h:97:45: error: function types not truly compatible in ISO C [-Werror=pedantic]
 extern int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
                                             ^
src/trusted/service_runtime/opensgx/libsgx/include/sgx-lib.h:97:45: error: function types not truly compatible in ISO C [-Werror=pedantic]
cc1: all warnings being treated as errors
gcc标志如下所示:

'-fPIE', '-m64', '-Wall', '-pedantic', '-Wextra', '-Wno-long-long', '-Wswitch-enum', '-Wsign-compare', '-Wundef', '-fdiagnostics-show-option', '-fvisibility=hidden', '-Werror', '-Wno-variadic-macros', '--param', 'ssp-buffer-size=4', '-O2', '-static', '-fno-stack-protector', '-Isrc/trusted/service_runtime/opensgx/include', '-Isrc/trusted/service_runtime/opensgx/share/include', '-Isrc/trusted/service_runtime/opensgx/libsgx/include', '-fPIC', '-fvisibility=hidden', '-std=gnu11', '-nostdlib'
是否有人知道导致
错误的原因:函数类型在ISO C中不真正兼容[-Werror=pedantic]

顺便说一句,如果我去掉
-pedantic
标志,一切都可以正常编译


谢谢

它指向每个函数的第二个参数,其中只有两个是
const
。另一种可能性是,每个函数定义之间的
struct sockaddr
在某种程度上是不同的?我认为这就是原因: