__ANDROID__ macro suddenly not defined

后端 未结 3 1943
清酒与你
清酒与你 2020-12-16 06:42

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.

3条回答
  •  执笔经年
    2020-12-16 07:17

    Just so you know:

    • when you work with Android.mk file(s) and ndk-build, the ANDROID 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
    

提交回复
热议问题