我在使用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)
任何建议都非常感谢!