How to compile c++11 code with android ndk and eclipse?

前端 未结 2 1121
孤独总比滥情好
孤独总比滥情好 2020-12-29 08:14

I\'m using android NDK r8d, and eclipse Juno. I\'m trying to compile C++ code which uses C++11 stuff like mutex, lock_guard, shared_ptr

相关标签:
2条回答
  • 2020-12-29 08:55

    I find export an environment variable NDK_TOOLCHAIN_VERSION=4.8 before i start eclipse can solve this problem.

    Eclipse use ndk's default toolchain version 4.6, if NDK_TOOLCHAIN_VERSION is not define, and gcc witch this version does not support all c++11's future like multithread and so on.

    0 讨论(0)
  • 2020-12-29 08:59

    Regarding your first question:

    1. Go to Project > Properties > C/C++ General / Paths and Symbols

    2. In the "Includes" tab, add the proper directory, e.g. /android-ndk-r8d/sources/cxx-stl/gnu-libstdc++/4.7/include

    Regarding your second question, I'm also looking for an answer. It is absolutely not clear how to define the GXX_EXPERIMENTAL_CXX0X macro in Eclipse.

    Some say that it should be "added as a predefined macro to the indexer", but it looks like we both could not find a way to implement that...

    I have read elsewhere that it should be added to "C/C++ General / Paths and Symbols / Symbols / GNU C++" but I can't find the "Symbols / GNU C++" part in my version of Indigo.

    0 讨论(0)
提交回复
热议问题