Ask Your Question

Revision history [back]

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>)'

Hello,

I am trying to use Open CV version 3.4.3 in android studio 3.4 and ndk:20.0.5594570. I have copied all the libs to jniLibs folders. But still seeing the error. Please help me with necessary steps.

ERROR

Build command failed. Error while executing process C:\Users**\AppData\Local\Android\Sdk\ndk\20.0.5594570\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users*\AndroidStudioProjects\MBSS\app\src\main\jni\Android.mk NDK_APPLICATION_MK=C:\Users*\AndroidStudioProjects\MBSS\app\src\main\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-14 NDK_OUT=C:/Users/*/AndroidStudioProjects/MBSS/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\Users*\AndroidStudioProjects\MBSS\app\build\intermediates\ndkBuild\debug\lib MyLibs} [armeabi-v7a] Compile++ thumb: MyLibs <= com_example_mbss_NativeClass.cpp [armeabi-v7a] Prebuilt : libopencv_java3.so <= C:/Users/**/Downloads/opencv-3.4.3-android-sdk/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/ [armeabi-v7a] Prebuilt : libc++_shared.so <= <ndk>/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/ [armeabi-v7a] SharedLibrary : libMyLibs.so

C:/Users/*/AndroidStudioProjects/MBSS/app/src/main/jni/com_example_mbss_NativeClass.cpp:26: 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++: error: linker command failed with exit code 1 (use -v to see invocation) make: [C:/Users/**/AndroidStudioProjects/MBSS/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libMyLibs.so] Error 1

Application.mk

APP_STL := c++_shared APP_CPPFLAGS := -frtti -fexceptions APP_PLATFORM := android-14

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

open cv

OPENCVROOT:=C:\Users**\Downloads\opencv-3.4.3-android-sdk\OpenCV-android-sdk OPENCV_CAMERA_MODULES:=on OPENCV_INSTALL_MODULES:=on OPENCV_LIB_TYPE:=SHARED

include $(OPENCVROOT)/sdk/native/jni/OpenCV.mk LOCAL_SRC_FILES := com_example_mbss_NativeClass.cpp

LOCAL_C_INCLUDES += $(LOCAL_PATH)

LOCAL_LDLIBS += -llog -ldl LOCAL_MODULE := MyLibs

include $(BUILD_SHARED_LIBRARY)