compiler-errors - 编译器错误堆栈跟踪

标签 compiler-errors g++

在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告诉我以下任何或所有信息:出现此错误之前代码中的最后一位,或者导致该编译器错误的完整代码跟踪,或者由我找出其他方法出如何解决我的代码?

最佳答案

最终,解决该问题的方法是,包含路径中的文件较早存在一个名为byteswap.h的文件,该文件被包含在byteswap.h的stdlib版本之前。由于该文件不包含bswap_64bswap_32bswap_16的定义,因此生成了编译器错误。

解决方法是将第三方库中的byteswap.h重命名为另一个不冲突的名称。

关于compiler-errors - 编译器错误堆栈跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17734832/

相关文章:

c++ - 使用文件内容作为硬编码字符串

java - 错误: could not find or load main class newClass JVM

python - TypeError : “NoneType” object is not iterable

vb.net - 如何为ForEach传递带有lambda表达式的System.Action参数?

linux - 无法在 Linux Mint 18 或 Ubuntu 16.04 上编译 a4tech-bloody-linux-driver

c++ - 使用 clang++、-fvisibility=hidden、typeinfo 和 type-erasure

c++ - 无法打开输出文件,权限被拒绝

android - 在几乎没有任何东西的情况下编译 FFmpeg

qt - 在 Ubuntu 16.04 上配置 Qt 5.9.5

c++ - 检查 move 未初始化的变量并使用 move 的变量