[android]std::map 链接器错误 ndk r8c 与 APP_STL: = gnustl_static
来源:互联网 发布:音质增强软件 编辑:程序博客网 时间:2024/06/07 07:15
发布时间: 2014/9/20 9:46:24
本文来自: http://stackoverflow.com/questions/13856480/stdmap-linker-error-ndk-r8c-with-app-stl-gnustl-static
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.
我有一些问题链接 STL 的故乡 application
。连接失败时的 map::insert 与 map::operator [] 成功与其他映射函数。我 Application.mk 是:
APP_STL := gnustl_static
APP_CPPFLAGS := -fexceptions -frtti
APP_CPPFLAGS += -g3
APP_CPPFLAGS += -DDEBUG
APP_ABI := armeabi-v7a
APP_PLATFORM:=android-14
NDK_TOOLCHAIN_VERSION:=4.6
本机代码包含两个文件夹级别。对于每个内部的文件夹,我创建了一个 Android.mk 文件来编译和生成的静态库。我使用 std::map 在最深的文件夹中。Android.mk 看起来像:
TEMP_PATH_REG := $(call my-dir)
LOCAL_PATH := $(TEMP_PATH_REG)
include $(call all-subdir-makefiles)
LOCAL_PATH := $(TEMP_PATH_REG)
include $(CLEAR_VARS)
LOCAL_MODULE := registration
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../glm/
LOCAL_SRC_FILES := registration_factory.cpp \
inertial.cpp
LOCAL_LDLIBS := -llog -landroid -lEGL
LOCAL_STATIC_LIBRARIES := android_native_app_glue
include $(BUILD_STATIC_LIBRARY)
$(call import-module,android/native_app_glue)
当我 build
项目得到了以下错误:
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree<int, std::pair<int const, xmar::IRegistration*>, std::_Select1st<std::pair<int const, xmar::IRegistration*> >, std::less<int>, std::allocator<std::pair<int const, xmar::IRegistration*> > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair<int const, xmar::IRegistration*> const&):~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:1013: error: undefined reference to 'std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
StaticLibrary : libandroid_native_app_glue.a
rm -f obj/local/armeabi-v7a/libandroid_native_app_glue.a
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree_const_iterator<std::pair<int const, xmar::IRegistration*> >::operator--():~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:284: error: undefined reference to 'std::_Rb_tree_decrement(std::_Rb_tree_node_base const*)'
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-ar crs ./obj/local/armeabi-v7a/libandroid_native_app_glue.a ./obj/local/armeabi-v7a/objs-debug/android_native_app_glue/android_native_app_glue.o
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree_const_iterator<std::pair<int const, xmar::IRegistration*> >::operator++():~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:269: error: undefined reference to 'std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'
Prebuilt : libgnustl_static.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree_iterator<std::pair<int const, xmar::IRegistration*> >::operator--():~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:203: error: undefined reference to 'std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
我的很多伊格错了吗?
多谢。
解决方法 1:
我发现了一种变通方法来编译项目。
LOCAL_LDLIBS += ~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.a
LOCAL_LDLIBS += ~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a
阅读全文
0 0
- [android]std::map 链接器错误 ndk r8c 与 APP_STL: = gnustl_static
- NDK的APP_STL与APP_LDFLAGS
- MAC android NDK r8c 安装
- Android NDK R8C 重新编译jni问题
- Android NDK R8C 重新编译jni问题
- 解决android-ndk-r8c 编译所有文件问题
- 解决android-ndk-r8c 编译所有文件问题
- 解决android-ndk-r8c 总是编译所有文件问题
- android ndk编译出现error :android-ndk-r8c/build/gmsl/__gmsl: 解决方法
- std::map与std::vector
- std::map与std::set
- std:map与迭代器简析
- std::map常见使用错误
- [android NDK]问题与错误总结
- 链接错误: "std::basic_string<char, std::char_traits<char>等错误
- 关于exlipse 中android ndk开发打开工程std错误解决方案
- Android NDK下载链接
- std::map key=std::pair
- Cg语言说明文档(一)
- Mysql数据库编码为UTF-8,但查询结果依旧乱码、为空解决办法
- Spring中@Autowired注解、@Resource注解的区别(转)
- @Repository、@Service、@Controller 和 @Component
- Anaconda
- [android]std::map 链接器错误 ndk r8c 与 APP_STL: = gnustl_static
- HTML标签marquee实现滚动效果
- HTML之文字过多以省略号代替
- 创建正态分布的点并用k均值算法聚类
- 在myeclipse中 如何移动多行代码,前后移动
- 覆盖toString()方法的坑
- mysql timestamp/current_timestamp设置注意事项
- Netty之Jboss Marshalling编解码
- Python-PyCharm项目删除