【发布时间】:2013-07-18 22:11:53
【问题描述】:
在 CentOS 5.9 [gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)] 上编译时。我的应用程序无法编译并出现以下错误:
/opt/qt64/4.7.3/include/QtCore/qendian.h: In function ‘T qbswap(T) [with T = long long unsigned int]’:
/opt/qt64/4.7.3/include/QtCore/qendian.h:278: error: ‘bswap_64’ was not declared in this scope
/opt/qt64/4.7.3/include/QtCore/qendian.h: In function ‘T qbswap(T) [with T = unsigned int]’:
/opt/qt64/4.7.3/include/QtCore/qendian.h:282: error: ‘bswap_32’ was not declared in this scope
/opt/qt64/4.7.3/include/QtCore/qendian.h: In function ‘T qbswap(T) [with T = short unsigned int]’:
/opt/qt64/4.7.3/include/QtCore/qendian.h:286: error: ‘bswap_16’ was not declared in this scope
我不认为 Qt 4.7.3 有什么问题,因为代码在 MSVC2010 和 Fedora 9 [gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC)] 上都可以正确编译 Qt 4.7.3,而不会发生任何问题。
我的问题,有没有办法让 GCC 告诉我以下任何或所有信息:在我的代码中出现此错误之前的最后一个位置或导致此编译器错误的完整代码跟踪或其他一些让我弄清楚如何修复我的代码的方法?
【问题讨论】:
-
CentOS 可能没有这些
bswap函数,或者它们位于不同的标头中。你检查了吗? -
不,我没有。我该如何检查?
-
grep -R bswap /usr/include/* -
好像在多个地方定义
/usr/include/asm-i386/byteorder.h /usr/include/asm-x86_64/byteorder.h /usr/include/bits/byteswap.h /usr/include/byteswap.h /usr/include/mtd/jffs2-user.h /usr/include/netinet/in.h -
好的,很酷。那么
qendian.h在其他地方寻找他们吗?
标签: compiler-errors g++