看来这个问题涉及到两个文件。 icu/source/common/unicode/ptypes.h 调用 sys/types.h 包括
#if ! U_HAVE_UINT64_T
typedef unsigned long long uint64_t;
/* else we may not have a 64-bit type */
#endif
通过包含 Android 中的 sys/types.h,我们涉及(第 122/124 行附近)
#ifdef __BSD_VISIBLE
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef uint32_t u_int32_t;
typedef uint16_t u_int16_t;
typedef uint8_t u_int8_t;
typedef uint64_t u_int64_t;
#endif
看来uint64_t在赋值给u_int64_t时还没有声明。事实上,sys/types.h 包含 stdint.h,它具有以下内容:
#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L
# define __STDC_INT64__
#endif
typedef __int8_t int8_t;
typedef __uint8_t uint8_t;
typedef __int16_t int16_t;
typedef __uint16_t uint16_t;
typedef __int32_t int32_t;
typedef __uint32_t uint32_t;
#if defined(__STDC_INT64__)
typedef __int64_t int64_t;
typedef __uint64_t uint64_t;
#endif
Likely 严格_ANSI没有定义。看起来这是 sys/types.h 中 Android 代码中的一个错误。如果STDC_INT64没有定义,它不会定义uint64_t,所以它不能定义u_int64_t。也许真正的解决方案是修改 sys/types.h 以便它具有
#ifdef __BSD_VISIBLE
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef uint32_t u_int32_t;
typedef uint16_t u_int16_t;
typedef uint8_t u_int8_t;
$if defined(__STDC_INT64__)
typedef uint64_t u_int64_t;
#endif
#endif
如果修复此问题,下一个错误将出现在 cstring.h:109 中
icu/source/common/cstring.h:109: error: 'int64_t' has not been declared
如果你改为#defineSTDC_INT64在 common/unicode/ptypes.h 中,它将走得更远,但将结束于
icu/source/common/ustrenum.cpp:118: error: must #include <typeinfo> before using typeid
更多信息请参见此处:http://groups.google.com/group/android-ndk/browse_thread/thread/2ec9dc289d815ba3?pli=1但没有真正的解决方案