【Android】Error:(32, 2) error: #error ....support for the ISO C++...

    xiaoxiao2023-03-25  6

    Error:(32, 2) error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

    解决方法:

    nullptr是C++11引入的新特性,解决C和C++中NULL的定义不一致所带来的编译器兼容问题。C中NULL是指向0地址的指针(void *)0,c++中则是定义为整数0.

    ndk中解决这个问题的办法就是添加对C++11的支持,在Application.mk中添加:

    NDK_TOOLCHAIN_VERSION = 4.9 APP_STL := gnustl_static APP_CPPFLAGS := -frtti -fexceptions -std=c++11 APP_ABI := armeabi armeabi-v7a APP_PLATFORM := android-8

    NDK_TOOLCHAIN_VERSION = 4.9   APP_CPPFLAGS := -frtti -std=c++11      <pre name="code" class="html">注意:NDK_TOOLCHAIN_VERSION 》= 4.7   重新ndk-build即可

    转载请注明原文地址: https://ju.6miu.com/read-1203499.html
    最新回复(0)