I\'m working on an app which uses NDK (all I\'m writing happened both on r6b and r8d)
Everything was working fine, and I wanted to start and try debugging my C code.
Apparently __ANDROID__
is a specific GCC macro that it supposed to define internally whenever correct options are provided. However, since control over options is largely delegated to NDK, one should not rely on __ANDROID__
macro being ever defined. The compiler behind NDK might not be GCC for all we know (or care). When working with NDK, check for ANDROID
.
Edit: clang now also defines __ANDROID__
macro
Just so you know:
Android.mk
file(s) and ndk-build
, the ANDROID
macro is predefined (see -DANDROID
extra C flag when building with verbose outputs),__ANDROID__
is predefined instead.So I suggest you to use:
#if defined(ANDROID) || defined(__ANDROID__)
/* ... */
#endif
If anyone else encounters this issue:
I opened the workspace on another computer (Workspace is in a Dropbox folder), and the problem was still there on the other computer, which could only mean a workspace issue, so I delete the .metadata folder from the workspace.
I had to re-add the projects, but after doing so, everything seems to work now.