我在 Ubuntu 上使用带有 Eclipse Indigo 的 Android NDK r7.我将我的 java 项目设置为使用 C++ 特性.我在 C++ 端使用 STL,所以我添加了
<块引用>APP_STL := gnustl_static在 Application.mk 文件中.
ndk-build 成功编译了我的代码并创建了一个共享对象.
但是 Eclipse 索引器抱怨缺少 STL 符号.例如
<块引用>方法‘push_back’无法解析"符号‘向量’无法解析解决"
只有在编辑器中打开 C++ 文件时才会发生这种情况.最终eclipse不会创建我的apk.我添加了 ndk 附带的 gnu STL 头文件的路径(属性 => C/C++ 常规 => 代码分析 => 路径和符号):
<块引用>android-ndk-r7/sources/cxx-stl/gnu-libstdc++/includeandroid-ndk-r7/sources/cxx-stl/gnu-libstdc++/include/bits当前的解决方法是关闭打开的 C++ 文件以使 eclipse 快乐.
有趣的是,eclipse 索引器与在中找到的标题一起工作正常
<块引用>android-ndk-r7/platforms/android-14/arch-arm/usr/include
有什么我忘记在 eclipse 中设置的吗?
您必须将 STL 的路径添加到项目设置中,以便 Eclipse 也对其进行索引.项目-> 属性-> C/C++ 常规-> 包含.这是我添加的内容:
/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 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
这篇关于将 STL 与 Android NDK 一起使用时出现 Eclipse 索引器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
上传进度侦听器未触发(Google 驱动器 API)Upload progress listener not fired (Google drive API)(上传进度侦听器未触发(Google 驱动器 API))
使用 Google Drive SDK 将文件保存在特定文件夹中Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 将文件保存在特定文件夹中)
Google Drive Android API - 无效的 DriveId 和 Null ResourcGoogle Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 无效的 DriveId 和 Null ResourceId)
检查上传和进度下载(适用于 Android 或 Java 的 GoCheck progress for Upload amp; Download (Google Drive API for Android or Java)(检查上传和进度下载(适用于 Android 或 Java 的 Google Drive
在 Android 上获取所有文件夹 google drive apiGet all folders google drive api on Android(在 Android 上获取所有文件夹 google drive api)
Android - 谷歌电子表格 APIAndroid - Google Spreadsheet Api(Android - 谷歌电子表格 API)