NDK 编码中 OpenCV 的未定义参考错误过多
too many undefined reference errors for OpenCV in NDK coding
当我在 android NDK 下编写 opencv 时,我得到许多未定义的引用错误,例如:
system.cpp:(.text.unlikely._ZNSs4_Rep10_M_disposeERKSaIcE.part.5+0x1c):
undefined reference to `std::string::_Rep::_M_destroy(std::allocator
const&)'
G:/AndroidProjects/SprayingPrjJNI/app/src/main/cpp/../jniLibs/arm64-v8a/libopencv_core.a(system.cpp.o):
In function `void std::_Destroy(std::string*, std::string*,
std::allocator&) [clone .isra.88]':
system.cpp:(.text.unlikely._ZSt8_DestroyIPSsSsEvT_S1_RSaIT0_E.isra.88+0x18):
undefined reference to `std::string::_Rep::_S_empty_rep_storage'
system.cpp:(.text.unlikely._ZSt8_DestroyIPSsSsEvT_S1_RSaIT0_E.isra.88+0x2c):
undefined reference to `std::string::_Rep::_S_empty_rep_storage'
..................
我真的不知道如何解决这些错误,请帮助我,谢谢
参见 。
但是如果您没有非常充分的理由继续使用旧版本的 OpenCV,最简单的方法是 与 NDK r19 兼容。
当我在 android NDK 下编写 opencv 时,我得到许多未定义的引用错误,例如:
system.cpp:(.text.unlikely._ZNSs4_Rep10_M_disposeERKSaIcE.part.5+0x1c): undefined reference to `std::string::_Rep::_M_destroy(std::allocator const&)'
G:/AndroidProjects/SprayingPrjJNI/app/src/main/cpp/../jniLibs/arm64-v8a/libopencv_core.a(system.cpp.o): In function `void std::_Destroy(std::string*, std::string*, std::allocator&) [clone .isra.88]':
system.cpp:(.text.unlikely._ZSt8_DestroyIPSsSsEvT_S1_RSaIT0_E.isra.88+0x18): undefined reference to `std::string::_Rep::_S_empty_rep_storage'
system.cpp:(.text.unlikely._ZSt8_DestroyIPSsSsEvT_S1_RSaIT0_E.isra.88+0x2c): undefined reference to `std::string::_Rep::_S_empty_rep_storage'
..................
我真的不知道如何解决这些错误,请帮助我,谢谢
参见
但是如果您没有非常充分的理由继续使用旧版本的 OpenCV,最简单的方法是