Eclipse的CDT未能找到NDK项目STDLIB符号符号、项目、未能找到、CDT

由网友(訡後啲鏴⒈個魜赱)分享简介:我想写使用NDK和C ++一个简单的Andr​​oid应用程序。具体来说,我想使用++附带NDK(R7)的最新版本的gnus​​tdc。 JNI的库编写并完全正常工作为C,但现在,我试图引进C ++,我碰到的一些问题。I am trying to write a simple Android application...

我想写使用NDK和C ++一个简单的Andr​​oid应用程序。具体来说,我想使用++附带NDK(R7)的最新版本的gnus​​tdc。 JNI的库编写并完全正常工作为C,但现在,我试图引进C ++,我碰到的一些问题。

I am trying to write a simple Android application using the NDK and C++. Specifically, I'd like to use the gnustdc++ included with the newest version of the NDK (r7). The JNI library has compiled and worked perfectly fine as C, but now that I'm trying to introduce C++, I've run into some issues.

我已经加入 $ {NDK_ROOT} /来源/ CXX-STL / GNU-的libstdc ++ /有/ 来我的项目包括道路,而 #包括内联得到解决。但是,试图真正使用任何STL类(如向量)的结果符号载体无法解析

I have added ${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/include/ to my project's include paths, and the #includes inline are resolved. However, attempting to actually use any STL class (such as vector) results in Symbol 'vector' could not be resolved.

所有的&LT进口的标准C符号< cstdlib> 。然后,它失败,功能'的malloc无法解析等等。

All of the standard C symbols imported from <stdlib.h> and such work as well, until I try to replace the #include with <cstdlib>. Then it fails with Function 'malloc' could not be resolved and so forth.

奇怪的是,加入STLport头(在 $ {NDK_ROOT} /来源/ CXX-STL / STLport的/ STLport的)修复了我所有的问题。不过我在链接GNU C ++,没有STLPort的,所以这是一个不方便的和不适当的解决方案的最好的。这似乎很奇怪,这些标题会工作,但别人不会。 Eclipse是没有索引或解决的GNU C ++头?

Oddly enough, adding the stlport headers (in ${NDK_ROOT}/sources/cxx-stl/stlport/stlport) fixes all of my issues. However I am linking in GNU C++, not STLPort, so this is an inconvenient and improper "solution" at best. It seems odd that these headers would work but the others would not. Is Eclipse failing to index or resolve the GNU C++ headers?

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libfoobar-jni
LOCAL_SRC_FILES := foobar.cpp
LOCAL_LDLIBS := -llog -lGLESv2

LOCAL_C_INCLUDES := sources/cxx-stl/gnu-libstdc++/include/
LOCAL_CFLAGS := -g -std=c99

include $(BUILD_SHARED_LIBRARY)

Application.mk

APP_STL := gnustl_shared

编辑:设置我的项目的基础上:

I set up my project based on:

的http://mhandroid.word$p$pss.com/2011/01/23/using-eclipse-for-android-cc-development/

推荐答案

看了这个,它有解决办法:

Read this, it has the solution:

http://comments.gmane.org/gmane.comp。 handhelds.android.ndk / 14371

的摘要,在情况下,链接模一些天是这样的:

The summary, in case the link dies some day is this:

这是在gnustl_shared模块声明的错误。比较遗憾的是,这将是固定在下一版本中。 在此期间,您可以手动更改 $ NDK /来源/ CXX-STL / GNU-的libstdc ++ / Android.mk 并替换该行,上面写着:

It's a bug in the gnustl_shared module declaration. Sorry about that, it will be fixed in the next release. In the meantime, you can manually change $NDK/sources/cxx-stl/gnu-libstdc++/Android.mk and replace the line that says:

LOCAL_EXPORT_LDLIBS := $(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/libsupc++.a

LOCAL_EXPORT_LDLIBS := $(call host-path,$(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/libsupc++.a)
阅读全文

相关推荐

最新文章