1

我在使用ndk-build的时候,总是出现这个错误,奇怪的是指向opencv库代码。

这是我收到的错误消息:

./obj//armeabi/objs/QRCA/QRCA.o: In function `~SURF`:
/----Path---/../sdk/native/jni/include/opencv2/nonfree/features2d.hpp:107: undefined reference to `vtable for cv::SURF`
/----Path---/../sdk/native/jni/include/opencv2/nonfree/features2d.hpp:107: undefined reference to `VTT for cv::SURF`
./obj/local/armeabi/objs/QRCA/QRCA.o: In function `fmatch(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >):`
/----Path---/jni/QRCA.cpp:28: undefined reference to `cv::SURF::SURF(double, int, int, bool, bool)`
/----Path---/jni/QRCA.cpp:36: undefined reference to `cv::SURF::SURF()`
./obj/local/armeabi/objs/QRCA/QRCA.o: In function `std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >::_M_range_check(unsigned int) const:`
~/Downloads/android-ndk-r8b/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_vector.h:780: undefined reference to `vtable for cv::SURF`
~/Downloads/android-ndk-r8b/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_vector.h:780: undefined reference to `VTT for cv::SURF`

这是我的 Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

include ../sdk/native/jni/OpenCV.mk

LOCAL_MODULE    := QRCA
LOCAL_SRC_FILES := QRCA.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS +=  -llog -ldl
LOCAL_WHOLE_STATIC_LIBRARIES := gnustl_static

include $(BUILD_SHARED_LIBRARY)

任何建议都非常感谢!

4

2 回答 2

1

请在提问之前先谷歌一下。这是答案:

http://answers.opencv.org/question/445/242-android-missing-nonfree-package/

于 2012-10-13T08:37:44.883 回答
1

我遇到了同样的问题,发现了这个: http ://web.guohuiwang.com/technical-notes/sift_surf_opencv_android (经过另一次检查,上面链接的评论中提到了)

这是关于如何设置它的演练,以便 NDK 可以使用非免费功能。

一般来说,这个想法是从其他发行版复制头文件/代码,然后编译您自己的 libnonfree.so 以使用这些功能。

我现在在我的开发环境中遇到困难,所以我不确定它有多容易,但它似乎已更新并且是解决方案的良好来源。

(我添加了这个答案,以便将它写在与问题相同的页面上,人们不必去其他网站并浏览评论来找到它)

于 2014-05-15T09:11:56.100 回答