Writing ORB brute force feature detection in C++ in android studio.

asked 2020-04-25 02:29:41 -0500

AAA gravatar image

But when i compile I'm getting this error

Build command failed.
Error while executing process D:\Android\Sdk\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C D:\Android Projects\nativeopencv\app\.cxx\cmake\debug\arm64-v8a native-lib}
ninja: Entering directory `D:\Android Projects\nativeopencv\app\.cxx\cmake\debug\arm64-v8a'
[1/1] Linking CXX shared library "D:\Android Projects\nativeopencv\app\build\intermediates\cmake\debug\obj\arm64-v8a\libnative-lib.so"


 FAILED: D:/Android Projects/nativeopencv/app/build/intermediates/cmake/debug/obj/arm64-v8a/libnative-lib.so 
    cmd.exe /C "cd . && D:\Android\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android28 --gcc-toolchain=D:/Android/ndk/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/Android/ndk/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -std=c++11 -std=gnu++11 -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libnative-lib.so -o "D:\Android Projects\nativeopencv\app\build\intermediates\cmake\debug\obj\arm64-v8a\libnative-lib.so" CMakeFiles/native-lib.dir/native-lib.cpp.o  -llog "D:/Android Projects/nativeopencv/app/src/main/jniLibs/arm64-v8a/libopencv_java3.so" -latomic -lm && cd ."
CMakeFiles/native-lib.dir/native-lib.cpp.o: In function `Java_com_example_nativeopencv_MainActivity_detectFeatures':
D:/Android Projects/nativeopencv/app/src/main/cpp/native-lib.cpp:50: undefined reference to `cv::DescriptorMatcher::match(cv::_InputArray const&, cv::_InputArray const&, std::__ndk1::vector<cv::DMatch, std::__ndk1::allocator<cv::DMatch> >&, cv::_InputArray const&) const'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
edit retag flag offensive close merge delete

Comments

you have to link -lopencv_features2d

berak gravatar imageberak ( 2020-04-25 02:38:58 -0500 )edit

Hi I just wanted to say i solved it by using this answer. But I don't know if its the correct way or not.

AAA gravatar imageAAA ( 2020-04-25 02:44:10 -0500 )edit

But I don't know if its the correct way or not.

what do you mean ? please explain.

berak gravatar imageberak ( 2020-04-25 03:02:44 -0500 )edit