错误:
templmatch.cpp:(.text+0x47e): undefined reference to `cv::getOptimalDFTSize(int)'
templmatch.cpp:(.text+0x494): undefined reference to `cv::getOptimalDFTSize(int)'
templmatch.cpp:(.text+0x92c): undefined reference to `cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
templmatch.cpp:(.text+0xfa4): undefined reference to `cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
templmatch.cpp:(.text+0x1006): undefined reference to `cv::mulSpectrums(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int, bool)'
templmatch.cpp:(.text+0x102e): undefined reference to `cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
解决方法:The problem was in the libraries order. The correct order is:
LOCAL_STATIC_LIBRARIES := libopencv_calib3d opencv_features2d opencv_flann opencv_imgproc opencv_core
So the main principle is you have to declare libraries in reverse order of their dependency (e.g. *opencv_imgproc* depends on *opencv_core* and *opencv_features2d* depends on *opencv_imgproc* and so on).
Qt Pro文件设置:
INCLUDEPATH += -L$$PWD ./Opencv/include \
-L$$PWD ./Opencv/include/opencv \
-L$$PWD ./Opencv/include/opencv2 \
LIBS +=-ljpeg \
-lpng \
-ljasper \
-ltiff \
-ldl \
-lz \
$${PWD}/Include/Sqlite3/libsqlite3.a \
$${PWD}/Include/Opencv/lib/libopencv_calib3d.a \
$${PWD}/Include/Opencv/lib/libopencv_features2d.a \
$${PWD}/Include/Opencv/lib/libopencv_flann.a \
$${PWD}/Include/Opencv/lib/libopencv_highgui.a \
$${PWD}/Include/Opencv/lib/libopencv_imgproc.a \
$${PWD}/Include/Opencv/lib/libopencv_core.a \
$${PWD}/Include/Opencv/lib/libIlmImf.a \