我在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
请给我这篇文章的任何反馈。
答案 0 :(得分:1)
typedef int foo;
typedef float foo;
请参阅,这是最小的例子,这与32位或64位无关。问题是某些头文件声明的符号比另一个已声明的符号,并且以不兼容的方式执行。我责怪PALsystypes,它没有任何业务声明特别是int64_t,它应该来自系统的stdint.h。
关于汇编程序警告,请考虑使用无符号整数,包括变量和常量(0x123u是无符号的)。