尝试在
Linux中使用android-ndk-r7交叉编译ICU时,在运行’make’时配置后发生以下错误
__/android-ndk-r7/platforms/android-8/arch-arm/usr/include/sys/types.h:124: error: 'uint64_t' does not name a type
这是由#include< sys / types.h>触发的.在icu / source / common / unicode / ptypes.h中:25.它似乎是android-ndk-n7中的一个非icu问题.在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;
typedef uint64_t u_int64_t;
#endif
这里的culprint是uint64_t,它在#include< stdint.h>中定义.在sys / types.h的顶部.我们在这里看到
#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L
# define __STDC_INT64__
#endif
...
#if defined(__STDC_INT64__)
typedef __int64_t int64_t;
typedef __uint64_t uint64_t;
#endif
如果从未定义STRICT_ANSI或STDC_VERSION以及STDC_INT64,则包括sys / types.h将抛出错误,因为永远不会定义uint64_t.以后调用int64_t(在icu代码中发生)和uint64_t的任何代码也会抛出相同的错误.我的临时解决方法是在#include< sys / types.h>之前在icu的ptypes.h顶部定义STDC_INT64.这是一个坏主意吗?