__android__ Macro Suddenly Not Defined
Solution 1:
Just so you know:
- when you work with
Android.mk
file(s) andndk-build
, theANDROID
macro is predefined (see-DANDROID
extra C flag when building with verbose outputs), - but if you use the Android Standalone Toolchain, then
__ANDROID__
is predefined instead.
So I suggest you to use:
#if defined(ANDROID) || defined(__ANDROID__)/* ... */#endif
Solution 2:
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
Solution 3:
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.
Post a Comment for "__android__ Macro Suddenly Not Defined"