我在使用Android NDK R7与日食靛蓝在Ubuntu。 我建立了我的Java项目使用C ++的性质。 我使用STL对C ++的一面,所以我说
APP_STL:= gnustl_static
在Application.mk文件。
NDK建造成功编译我的code和创建一个共享对象。
不过日食索引器抱怨缺少的STL符号。例如
方法的push_back无法解析符号'向量'不能 要解决
这仅发生在C ++文件在编辑器中打开。 最终,日食不会造成我的apk。 我加了路径shiped与NDK(属性=> C / C ++通用=> code Analasys =>路径和放大器;符号)GNU的STL头:
的Android NDK-R7 /来源/ CXX-STL / GNU-的libstdc ++ /包括
Android的NDK-R7 /来源/ CXX-STL / GNU-的libstdc ++ /有/位
目前的解决方法是关闭打开的C ++文件,使日食开心。
有趣的是月食索引器的工作正常,在
发现头Android的NDK-R7 /平台/ Android为14 /弓臂/ usr / include目录
有什么我忘了设置在Eclipse?
解决方案您必须添加路径STL项目的设置,使Eclipse的索引它。项目 - >属性 - > C / C ++通用>包括。以下是我已经添加了:
< path_to_NDK> /来源/ CXX-STL / GNU-的libstdc ++ /包括
< path_to_NDK> /来源/ CXX-STL / GNU-的libstdc ++ /库/ armeabi-V7A /包括
< path_to_NDK> /平台/ Android的9 /弓臂/ usr / include目录
I'm using the Android NDK r7 with eclipse Indigo on Ubuntu. I set up my java project to use the C++ nature. I'm using STL on C++ side so I added
APP_STL := gnustl_static
in the Application.mk file.
ndk-build succeed compiling my code and creating a shared object.
However eclipse indexer complains about missing STL symbols. For example
"Method 'push_back' could not be resolved" "Symbol 'vector' could not be resolved"
This happens only when C++ files are open in the editor. Ultimately eclipse won't create my apk. I added path to the gnu STL headers shiped with the ndk (Properties => C/C++ General => Code Analasys => Path & symbols) :
android-ndk-r7/sources/cxx-stl/gnu-libstdc++/include
android-ndk-r7/sources/cxx-stl/gnu-libstdc++/include/bits
Current workaround is to close opened C++ files to make eclipse happy.
Interestingly eclipse indexer's working fine with headers found in
android-ndk-r7/platforms/android-14/arch-arm/usr/include
Is there something I forgot to set up in eclipse ?
解决方案You have to add path to STL to project settings so that Eclipse indexes it as well. Project->Properties->C/C++ General->Includes. Here's what I have added:
<path_to_NDK>/sources/cxx-stl/gnu-libstdc++/include
<path_to_NDK>/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include
<path_to_NDK>/platforms/android-9/arch-arm/usr/include