Opencv error: undefined reference to 'cv::CascadeClassifier::detectMultiScale

asked 2018-10-18 09:09:47 -0600

Sar gravatar image

updated 2018-10-18 23:53:20 -0600

Hi,

I am newbie to OpenCV. I am using latest version for android openCVLibrary343. getting error while running project..

[OpenCv Face Detection](https://github.com/opencv/opencv/blob/master/samples/android/face-detection/src/org/opencv/samples/facedetect/DetectionBasedTracker.java)    


Build command failed.

Error while executing process C:\Users\admin\AppData\Local\Android\sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=E:\MyOpenDetections\app\src\main\jni\Android.mk NDK_APPLICATION_MK=E:\MyOpenDetections\app\src\main\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=E:/MyOpenDetections/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=E:\MyOpenDetections\app\build\intermediates\ndkBuild\debug\lib E:/MyOpenDetections/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libMyLibs.so}

[armeabi-v7a] Compile++ thumb: MyLibs <= com_sar_pahc_DetectionBasedTracker.cpp

[armeabi-v7a] Prebuilt       : libopencv_java3.so <= E:/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/

[armeabi-v7a] SharedLibrary  : libMyLibs.so

E:/MyOpenDetections/app/src/main/jni/com_sar_pahc_DetectionBasedTracker.cpp:37: error: undefined reference to 'cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__ndk1::vector<cv::Rect_<int>, std::__ndk1::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [E:/MyOpenDetections/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libMyLibs.so] Error 1

Unable to figure out what is the issue. I tried to use gnustl_static but ndk not supporting it and stops the build with an error. Please help guys.

edit retag flag offensive close merge delete

Comments

I had similar issue. In turned out that you got to use similar Android NDK as one that was used to build OpenCV Android SDK, that in case of versions ~3.4 is Android NDK 10. Recently, OpenCV Android SDK 4.0.1 have been released and it works with the newest NDK version (19 at the time).

Michał Kowalczyk gravatar imageMichał Kowalczyk ( 2019-01-28 15:58:19 -0600 )edit