Search code examples
androidc++c++11android-ndkantlr

I just want to use a C++11 lib in Android 4.4


I want to embed Antlr4.8 C++ runtime lib in our App which supports Android 4.4.

I have checked the official Google Doc about NDK, but still don't know the relationship between NDK version and Android System version and C++ version.

So can anyone give me some tip or "more detail" Doc about embed C++11 lib in Android App? Thanks.

By the way, i am an iOS developer so this is difficult for me and i still try hard to learn Android NDK development.


Solution

  • According to release notes of the current Android NDK v21, the toolchain uses Clang release r365631 (the master branch as of 10 July 2019), which corresponds to Clang 9.0.6.

    That means that C++ is supported all the way up to C++17, and even some parts of C++20.

    So C++11 is no problem at all.


    Note: to use the latest C++17 features, you might have to link with the latest libc++ statically (-static-libstdc++), as explained here. For C++11 this most likely won't be needed.