'__u32 __fswab32(__u32)' 不能出现在 netinet/tcp_md5.h 的常量表达式中
'__u32 __fswab32(__u32)' cannot appear in a constant-expression in netinet/tcp_md5.h
在我的一个代码中,我遇到了以下错误,因为我正在使用 。
==========错误========
/auto/andpkg/rep_cache//wr-x86-xeon/5.0/sysroot/intel_xeon_32_core-wrs-linux/usr/include/linux/tcp.h:72:17: error: '__u32 __fswab32(__u32)' cannot appear in a constant-expression
=========================
于是我改为netinet/tcp.h,错误解决。然而,下一个头文件是 netinet/tcp_md5.h,我发现 netinet/tcp_md5.h 依次包含 。所以现在我遇到了相同的编译错误和一些重新声明错误。
=========重新声明错误===============
在 ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing 包含的文件中-sw/include/pre-os/netinet/tcp_md5.h:59:0,
来自 ../../../../zeromq/conf.x86it/../zeromq-4.0.1/src/options.hpp:38,
来自 ../../../../zeromq/conf.x86it/../zeromq-4.0.1/src/ctx.cpp:30: ../../../.. /zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os /linux/tcp.h:91:0: 错误:"TCP_NODELAY" 重新定义 [-Werror] ../../../../zeromq/conf.x86it/../zeromq-4.0 .1/../../../../routing-sw/include/pre-os/netinet/tcp.h:148:0: 注意:这是前面的位置定义../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:92:0: 错误:"TCP_MAXSEG" 重新定义 [-Werror] ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/netinet/tcp.h:149 :0: 注意:这是前面定义的位置../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../ ../routing-sw/include/pre-os/x86it/os/linux/tcp.h:94:0: 错误:"TCP_KEEPIDLE" 重新定义 [-Werror] 。 ./../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/netinet/tcp.h:158:0: 注意:这里是之前定义的位置../../../../zeromq/conf.x86it/../zeromq-4.0 .1/../../../../ routing-sw/include/pre-os/x86it/os/linux/tcp.h:95:0: 错误:"TCP_KEEPINTVL" 重新定义 [-Werror] ../. ./../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/ netinet/tcp.h:159:0: 注意:这里是之前定义的位置../../../../zeromq/conf.x86it/../zeromq-4.0.1/ ../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:96:0: 错误: "TCP_KEEPCNT" 重新定义 [-Werror] ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing- sw/include/pre-os/netinet/tcp.h:157:0: 注意:这里是前面定义的位置
../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:24:8: error: redefinition of 'struct tcphdr'
../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/netinet/tcp.h:67:8:
error: previous definition of 'struct tcphdr'
==========================
==========常量表达式再次出错==========
../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:72:17:
error: '__u32 __fswab32(__u32)' cannot appear in a constant-expression
../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:72:17:
error: a function call cannot appear in a constant-expression
../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:73:17:
error: '__u32 __fswab32(__u32)' cannot appear in a constant-expression
=============
似乎存在 cross 依赖项。有人遇到过这个问题吗?解决这个问题的方法是什么?
在CXXFLAGS
中添加-std=c++0x
后,编译顺利:
CXXFLAGS = -Wall \
-pipe \
-g \
-O2 \
-fno-crossjumping \
-fno-strict-aliasing \
-march=pentiumpro \
--sysroot=/auto/andpkg/rep_cache//wr-x86-xeon/5.0/sysroot/intel_xeon_32_core-wrs-linux \
-m32 \
-Wno-variadic-macros \
-std=c++0x
在我的一个代码中,我遇到了以下错误,因为我正在使用
==========错误========
/auto/andpkg/rep_cache//wr-x86-xeon/5.0/sysroot/intel_xeon_32_core-wrs-linux/usr/include/linux/tcp.h:72:17: error: '__u32 __fswab32(__u32)' cannot appear in a constant-expression
=========================
于是我改为netinet/tcp.h,错误解决。然而,下一个头文件是 netinet/tcp_md5.h,我发现 netinet/tcp_md5.h 依次包含
=========重新声明错误===============
在 ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing 包含的文件中-sw/include/pre-os/netinet/tcp_md5.h:59:0, 来自 ../../../../zeromq/conf.x86it/../zeromq-4.0.1/src/options.hpp:38, 来自 ../../../../zeromq/conf.x86it/../zeromq-4.0.1/src/ctx.cpp:30: ../../../.. /zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os /linux/tcp.h:91:0: 错误:"TCP_NODELAY" 重新定义 [-Werror] ../../../../zeromq/conf.x86it/../zeromq-4.0 .1/../../../../routing-sw/include/pre-os/netinet/tcp.h:148:0: 注意:这是前面的位置定义../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:92:0: 错误:"TCP_MAXSEG" 重新定义 [-Werror] ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/netinet/tcp.h:149 :0: 注意:这是前面定义的位置../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../ ../routing-sw/include/pre-os/x86it/os/linux/tcp.h:94:0: 错误:"TCP_KEEPIDLE" 重新定义 [-Werror] 。 ./../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/netinet/tcp.h:158:0: 注意:这里是之前定义的位置../../../../zeromq/conf.x86it/../zeromq-4.0 .1/../../../../ routing-sw/include/pre-os/x86it/os/linux/tcp.h:95:0: 错误:"TCP_KEEPINTVL" 重新定义 [-Werror] ../. ./../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/ netinet/tcp.h:159:0: 注意:这里是之前定义的位置../../../../zeromq/conf.x86it/../zeromq-4.0.1/ ../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:96:0: 错误: "TCP_KEEPCNT" 重新定义 [-Werror] ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing- sw/include/pre-os/netinet/tcp.h:157:0: 注意:这里是前面定义的位置
../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:24:8: error: redefinition of 'struct tcphdr' ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/netinet/tcp.h:67:8: error: previous definition of 'struct tcphdr'
==========================
==========常量表达式再次出错==========
../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:72:17: error: '__u32 __fswab32(__u32)' cannot appear in a constant-expression ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:72:17: error: a function call cannot appear in a constant-expression ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it/os/linux/tcp.h:73:17: error: '__u32 __fswab32(__u32)' cannot appear in a constant-expression
=============
似乎存在 cross 依赖项。有人遇到过这个问题吗?解决这个问题的方法是什么?
在CXXFLAGS
中添加-std=c++0x
后,编译顺利:
CXXFLAGS = -Wall \
-pipe \
-g \
-O2 \
-fno-crossjumping \
-fno-strict-aliasing \
-march=pentiumpro \
--sysroot=/auto/andpkg/rep_cache//wr-x86-xeon/5.0/sysroot/intel_xeon_32_core-wrs-linux \
-m32 \
-Wno-variadic-macros \
-std=c++0x