c++ - g++错误:word64没有命名类型

标签 c++ c g++ 64-bit

我试图编译软件包,但在编译时出现此错误

sha.cpp:29: error: ‘word64’ does not name a type

我查看了源代码,相关部分是
#if HAVE64
    word64 bytes;
#else
    word32 bytesHi, bytesLo;
#endif

从sha.cpp,第29-33行

我发现在另一个文件中以以下方式声明了word64
#include <limits.h>

#ifdef __cplusplus
extern "C" {
#endif

#if UCHAR_MAX == 0xff
typedef unsigned char byte;
typedef signed char int8;
#else
#error This machine has no 8-bit type
#endif

#if UINT_MAX == 0xffff
typedef uint word16;
typedef int int16;
#elif USHRT_MAX == 0xffff
typedef unsigned short word16;
typedef short int16;
#else
#error This machine has no 16-bit type
#endif

#if UINT_MAX == 0xfffffffful
typedef uint word32;
typedef int int32;
#elif ULONG_MAX == 0xfffffffful
typedef ulong word32;
typedef long int32;
#else
#error This machine has no 32-bit type
#endif

#if ULONG_MAX > 0xfffffffful
#if ULONG_MAX == 0xfffffffffffffffful
typedef ulong bnword64;
#define BNWORD64 bnword64
#define HAVE64 1
#endif
#endif



#ifndef HAVE64
#if defined(ULONG_LONG_MAX) || defined (ULLONG_MAX) || defined(ULONGLONG_MAX)
typedef unsigned long long word64;
typedef long long int64;
#define HAVE64 1
#endif
#endif

我的系统是
Linux EmbeddedLinux 2.6.32-431.1.2.el6.x86_64 #1 SMP Sun Nov 24 09:37:37 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

我用来编译的编译器
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)

我浏览了互联网以解决此问题,但未找到任何线索。
任何帮助将不胜感激

最佳答案

您似乎在某个地方缺少定义了word64和word32的头文件。尝试通过文本搜索找到该库。如果找不到该库,那么很难找出该库的作者试图定义为word63 / 32的内容。

您可以尝试进行以下猜测(这是一个猜测,因此可能不起作用):在引用的片段之前,将以下行添加到sha.cpp中:

#include <stdint.h>

typedef uint64_t word64;
typedef uint32_t word32;

或者,如果这不起作用,请尝试以下操作:
#include <stdint.h>

typedef int64_t word64;
typedef int32_t word32;

祝好运!

关于c++ - g++错误:word64没有命名类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22554338/

相关文章:

linux - 如何获得适用于 Linux FC-14 的 g++

c++ - 如何获取 n 行的整数直到\n

C++ 14制作自定义迭代器,它将经过2并返回修改后的数据

c++ - G++编译,mac os和ubuntu的区别

c - 学习C、段错误

c - 如果我声明一个 char 数组,我是否也必须计算空字符?

linux - 制作-j 8 g++ : internal compiler error: Killed (program cc1plus)

C++ 指针 "error: double free or corruption (out)"

c++ - 如何将指针转换为未命名的结构指针?

c - 在大括号和没有大括号的列表中声明的值有什么区别