centos7 Qt5.9.1 编译opencv错误

74 篇文章 4 订阅
39 篇文章 0 订阅

错误:

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 \


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值