在 CentOS 6.x 64 位操作系统中构建C++项目时出错

Errors in building C++ project in CentOS 6.x 64 bit OS

本文关键字:C++ 构建 项目 出错 操作系统 CentOS      更新时间:2023-10-16

我在 64 位 CentOS 6.x 中构建项目时遇到一些错误C++。该项目已在 32 位 CentOS 6.x 中成功构建。尽管有一些关于这些类型错误的线程,但我需要更多澄清。错误是——

/usr/include/sys/types.h:198: error: conflicting declaration ‘typedef long int int64_t’
./Headers/PALsystypes.h:22: error: ‘int64_t’ has a previous declaration as ‘typedef long  long int int64_t’
/usr/include/sys/types.h:204: error: conflicting declaration ‘typedef long unsigned int u_int64_t’
./Headers/PALsystypes.h:23: error: ‘u_int64_t’ has a previous declaration as ‘typedef long long unsigned int u_int64_t’

还有更多如下错误-

d5-x86_64.o md5-x86_64.s
md5-x86_64.s: Assembler messages:
md5-x86_64.s:41: Error: 0xd76aa478 out range of signed 32bit displacement
md5-x86_64.s:50: Error: 0xe8c7b756 out range of signed 32bit displacement
md5-x86_64.s:68: Error: 0xc1bdceee out range of signed 32bit displacement
md5-x86_64.s:77: Error: 0xf57c0faf out range of signed 32bit displacement
md5-x86_64.s:95: Error: 0xa8304613 out range of signed 32bit displacement
md5-x86_64.s:104: Error: 0xfd469501 out range of signed 32bit displacement
md5-x86_64.s:122: Error: 0x8b44f7af out range of signed 32bit displacement
md5-x86_64.s:131: Error: 0xffff5bb1 out range of signed 32bit displacement

请给我对这篇文章的任何反馈。

typedef int foo;
typedef float foo;

看,有一个最小的例子,这与 32 或 64 位无关。问题是某些头文件声明的符号比另一个已声明的符号要多,并且以不兼容的方式这样做。我会责怪PALsystypes,它没有声明特定int64_t的业务,这应该来自系统的stdint.h。

关于汇编程序警告,请考虑使用无符号整数,变量和常量(0x123u 是无符号的)。