错误:ISO C中的功能类型不兼容[-Werror = pedantic]

时间:2015-11-19 02:24:31

标签: c gcc

当我尝试编译C源代码时,包括" sgx-lib.h"头文件,使用gcc,它弹出以下错误:

 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'

有谁知道error: function types not truly compatible in ISO C [-Werror=pedantic]的原因是什么?

顺便说一下,如果我删除-pedantic标志,那么一切都很好。

谢谢!

0 个答案:

没有答案