简体   繁体   中英

AndroidStudio C++ Compiler Options

While trying to run my code, which is include C++ files I get the following error -

Error:(32, 2) 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.

How it can be solved? This is my first project that involved with C++ files.

I have rebuild my project and use C++11 instead of ToolChain Default in Customize C++ Support page. I think it is a dirty way for solving this problem.

In app's build gradle under android -> defaultConfig you can add / change the following

externalNativeBuild {
        cmake {
            cppFlags "-std=c++11"
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM