参考了这篇博客:
https://blog.csdn.net/qq_42027706/article/details/122210273
1.QT去官网镜像下载的5.12.9,opencv就用的博客上传的3.4
QT地址
下载完成后,因为使用的是已经编译过的opencv,直接把云盘中OpenCV的文件复制下来,放到Qt里面。
2.环境变量配置
Qt和OpenCV各需要配置一个Path路径
Qt的Path:XXX\Qt\qt5.12.9\Tools\mingw530_32\bin
OpenCV的Path:XXX\Qt\opencv3.4.0\OpenCV-MinGW-Build-OpenCV-3.4.5\x86\mingw\bin
配置完记得重启
3.pro设置
新建一个项目需要在.pro文件中添加INCLUDEPATH 和LIBS;
INCLUDEPATH +=H:\Qt\opencv3.4.0\OpenCV-MinGW-Build-OpenCV-3.4.5\include \
H:\Qt\opencv3.4.0\OpenCV-MinGW-Build-OpenCV-3.4.5\include \
H:\Qt\opencv3.4.0\OpenCV-MinGW-Build-OpenCV-3.4.5\include\opencv2
LIBS +=H:\Qt\opencv3.4.0\OpenCV-MinGW-Build-OpenCV-3.4.5\x86\mingw\bin\libopencv_*.dll