'__ u32 __fswab32(__ u32)'不能出现在netinet / tcp_md5.h中的常量表达式中。

问题描述 投票:2回答:1
在我的代码之一中,由于正在使用,因此我面临以下错误。

==========错误========

/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:错误:重新定义了'struct tcphdr' ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/netinet /tcp.h:67:8: 错误:“ struct tcphdr”的先前定义]

========================>

==========再次出现常量表达式错误===========>

../../../../ zeromq / conf.x86it /../ zeromq-4.0.1 /../../../../ routing-sw / include / pre-os /x86it/os/linux/tcp.h:72:17: 错误:'__ u32 __fswab32(__ u32)'无法出现在常量表达式中 ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it /os/linux/tcp.h:72:17: 错误:函数调用不能出现在常量表达式中 ../../../../zeromq/conf.x86it/../zeromq-4.0.1/../../../../routing-sw/include/pre-os/x86it /os/linux/tcp.h:73:17: 错误:“ __ u32 __fswab32(__ u32)”无法出现在常量表达式中

============== >>

似乎存在交叉依赖性。有人遇到过这个问题吗?解决此问题的方法是什么?

在我的代码之一中,由于使用

,因此我面临以下错误。 ==========错误======== /auto/andpkg/rep_cache//wr-x86-xeon/5.0/sysroot/intel_xeon_32_core-wrs-linux/usr/include / ...

-std=c++0x中添加

CXXFLAGS

之后,编译顺利进行了:
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
linux cross-compiling zeromq
1个回答
2
投票
-std=c++0x中添加

CXXFLAGS

之后,编译顺利进行了:
© www.soinside.com 2019 - 2024. All rights reserved.