在android 中移植一个库(该库 使用了 libstlport )时 产生如下错误:

prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: obj/EXECUTABLES/homographic_test_intermediates/libImage/image_io.o: in function std::vector<unsigned char, std::allocator<unsigned char> >::vector(unsigned int):external/stlport/stlport/stl/_vector.h:73: error: undefined reference to '__cxa_end_cleanup'


prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: obj/EXECUTABLES/homographic_test_intermediates/libImage/image_io.o:(.ARM.extab.text._ZNSt6vectorIhSaIhEEC1Ej+0x0): error: undefined reference to '__gxx_personality_v0'

解决 过程:

1. 添加

LOCAL_LDFLAGS := -Wl,-v

打印出配置信息

发现 缺少 stdc++ and supc++

 

2. 添加:

LOCAL_LDFLAGS += -Landroid/prebuilt/ndk/android-ndk-r6/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a -lstdc++\
        -Landroid/prebuilt/darwin-x86/toolchain/arm-linux-androideabi-4.4.x/arm-linux-androideabi/lib/armv7-a -lsupc++

 

问题解决 ^^

Logo

更多推荐