0

我在 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

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

4

1 回答 1

1
typedef int foo;
typedef float foo;

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

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

于 2013-01-25T06:13:15.503 回答