Compiling ICU for Android - 'uint64_t' does not name a type

余生颓废 提交于 2019-12-01 06:22:41

The main issue is that uint64_t isn't a defined type in C versions prior to C99. The best way to have it defined is to tell gcc which standard you'd like to use.

For c++, that's passing the -std=gnu++0x flag. For C, that's passing -std=c99

I.e. add a line something like

APP_CPPFLAGS= -std=gnu++0x

to your Application.mk file.

Alternatively, you can just hack it via your #define; I just wouldn't distribute code with such a hack as it's fragile.

tofutim

-D__STDC_INT64__ allows uint64_t and int64_t to be defined in Android's stdint.h.

However, this is not the ideal fix. The error has to do with Android, stdint and -std=c++0x. See What's the difference in GCC between -std=gnu++0x and -std=c++0x and which one should be used? for further information. If you follow the train of thought, an alternate (better??) fix is to modify the icu configuration script so that it calls for gnu++0x instead of c++0x. That's probably the right thing to do.

*** 7238,7244 ****
          OLD_CFLAGS="${CFLAGS}"
          OLD_CXXFLAGS="${CXXFLAGS}"
          CFLAGS="${CFLAGS} -std=gnu99 -D_GCC_"
!         CXXFLAGS="${CXXFLAGS} -std=c++0x"
          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */

--- 7241,7247 ----
          OLD_CFLAGS="${CFLAGS}"
          OLD_CXXFLAGS="${CXXFLAGS}"
          CFLAGS="${CFLAGS} -std=gnu99 -D_GCC_"
!         CXXFLAGS="${CXXFLAGS} -std=gnu++0x"
          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */

***************

I have resolved this situation by adding in to icudefs.mk into CPPFLGAS an option -D__STDC_INT64__

Can you set -DU_HAVE_UINT64_T=0 ?

Update to NDK 8e it supports more things from C++11

Also your Application.mk should contains some flags look at my file

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -DDEBUG=1
APP_USE_CPP0X := true
NDK_TOOLCHAIN_VERSION=4.7
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!