android – std :: map链接器错误ndk r8c与APP_STL:= gnustl_static

android – std :: map链接器错误ndk r8c与APP_STL:= gnustl_static,第1张

概述我在Native应用程序中链接STL时遇到了一些问题.使用map :: operator []和map :: insert连接失败,同时与其他map函数成功. 我的Application.mk是: APP_STL := gnustl_staticAPP_CPPFLAGS := -fexceptions -frttiAPP_CPPFLAGS += -g3APP_CPPFLAGS += -DDE 我在Native应用程序中链接STL时遇到了一些问题.使用map :: operator []和map :: insert连接失败,同时与其他map函数成功.
我的Application.mk是:

APP_STL := gnustl_staticAPP_CPPFLAGS := -fexceptions -frttiAPP_CPPFLAGS += -g3APP_CPPFLAGS += -DDEBUGAPP_ABI := armeabi-v7aAPP_PLATFORM:=androID-14NDK_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            := registrationLOCAL_C_INCLUDES     := $(LOCAL_PATH)/../glm/LOCAL_SRC_fileS        := registration_factory.cpp \                                          inertial.cpp                                       LOCAL_LDliBS               := -llog -landroID -lEGLLOCAL_STATIC_liBRARIES     := androID_native_app_glueinclude $(BUILD_STATIC_liBRARY)$(call import-module,androID/native_app_glue)

当我构建项目时,我收到以下错误

~/.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*,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&)'Staticlibrary  : libandroID_native_app_glue.arm -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*)'

我做错了什么?

非常感谢.

解决方法 我找到了一个编译项目的解决方法.

LOCAL_LDliBS += ~/.androID-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.aLOCAL_LDliBS += ~/.androID-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a
总结

以上是内存溢出为你收集整理的android – std :: map链接器错误ndk r8c与APP_STL:= gnustl_static全部内容,希望文章能够帮你解决android – std :: map链接器错误ndk r8c与APP_STL:= gnustl_static所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1128759.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存