PRIx64 format macro not defined when compiling for armeabi-v7a

807 views Asked by At

To print uint64_t values, I am using the PRIx64 macro. This works on all platforms I tried (iOS, Windows, Linux, arm64 Android.)

But on 32 bit ARM Android, the macro does not seem to be available:

When compiling:

LOGI("Cannot find %" PRIx64 " in wld.", item);

I get:

actors_pathing.cpp:234:25: error: expected ')' LOGI("Cannot find %" PRIx64 " in wld.", item); ^

arm64-v8a works fine, but armeabi-v7a does not. Surely, 32 bit arm code should be able to print out 64 bit integers?

Using: NDK r13b (latest)

In Application.mk: APP_ABI := armeabi-v7a

2

There are 2 answers

0
Bram On BEST ANSWER

A macro needs to be defined when using PRIx64 format:

-D__STDC_FORMAT_MACROS

0
user18853 On

Add this line to your Android.mk:

LOCAL_CPPFLAGS := -D__STDC_FORMAT_MACROS