带有ndk 18的未定义引用错误OpenCv Android(c ++ _ static)

时间:2018-09-21 04:13:29

标签: android opencv android-ndk

我更新了Android Studio以使用ndk18并进行了更改:

APP_STL := c++_static

这会导致OpenCv中出现许多链接器错误:

../thirdparty/opencv-android-sdk/sdk/native/jni/../libs/arm64-v8a/libopencv_objdetect.a(detection_based_tracker.cpp.o): In function `cv::DetectionBasedTracker::updateTrackedObjects(std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > > const&)':
detection_based_tracker.cpp:(.text._ZN2cv21DetectionBasedTracker20updateTrackedObjectsERKSt6vectorINS_5Rect_IiEESaIS3_EE+0xad8): undefined reference to `std::__throw_length_error(char const*)'
../thirdparty/opencv-android-sdk/sdk/native/jni/../libs/arm64-v8a/libopencv_objdetect.a(detection_based_tracker.cpp.o): In function `_GLOBAL__sub_I_detection_based_tracker.cpp':
detection_based_tracker.cpp:(.text.startup._GLOBAL__sub_I_detection_based_tracker.cpp+0x18): undefined reference to `std::ios_base::Init::Init()'
detection_based_tracker.cpp:(.text.startup._GLOBAL__sub_I_detection_based_tracker.cpp+0x1c): undefined reference to `std::ios_base::Init::~Init()'
detection_based_tracker.cpp:(.text.startup._GLOBAL__sub_I_detection_based_tracker.cpp+0x34): undefined reference to `std::ios_base::Init::~Init()'

该如何解决?

我正在使用OpenCv android sdk 3.1。

2 个答案:

答案 0 :(得分:1)

您需要针对libc ++重建opencv。

答案 1 :(得分:0)

您需要基于NDK 18重建opencv,我已经用opencv 2.4完成了

https://github.com/2666fff/opencv-for-android