undefined reference to `cv::medianBlur(cv::
System information (version) OpenCV = 3.4.2 Operating System / Platform = Windows 64 Bit Compiler = clang++ Android Studio = 3.1.3 NDK 17.1 Detailed description I'm following this post to try OpenCV native development. However, the compiler is giving me error:
Build command failed.
Error while executing process C:\Users\yuh5\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build Q:\TestOpenCVNative\app\.externalNativeBuild\cmake\debug\arm64-v8a --target native-lib}
[1/2] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o
[2/2] Linking CXX shared library ..\..\..\..\build\intermediates\cmake\debug\obj\arm64-v8a\libnative-lib.so
FAILED: cmd.exe /C "cd . && C:\Users\yuh5\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android --gcc-toolchain=C:/Users/yuh5/AppData/Local/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64 --sysroot=C:/Users/yuh5/AppData/Local/Android/Sdk/ndk-bundle/sysroot -fPIC -isystem C:/Users/yuh5/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/aarch64-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -std=c++11 -frtti -fexceptions -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot C:/Users/yuh5/AppData/Local/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm64 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -LC:/Users/yuh5/AppData/Local/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o ..\..\..\..\build\intermediates\cmake\debug\obj\arm64-v8a\libnative-lib.so CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -llog -latomic -lm "C:/Users/yuh5/AppData/Local/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a" "C:/Users/yuh5/AppData/Local/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++abi.a" && cd ."
CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o: In function `Java_com_example_yuh5_testopencvnative_EdgeDetection_detectEdges':
Q:\TestOpenCVNative\app\src\main\cpp/native-lib.cpp:27: undefined reference to `cv::medianBlur(cv::_InputArray const&, cv::_OutputArray const&, int)'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Steps to reproduce Here is the link to my git repo: https://github.com/Yu-Hang/OpenCVNative
add a comment