简体   繁体   English

QT Creator:无法添加OpenCV dll lib(“文件格式无法识别”)

[英]QT Creator: OpenCV dll lib can not be added (“File format not recognized”)

I'm trying to get openCV 3.1.0 to work in QT Creator 4.4.1 using this tutorial from their official site. 我试图让openCV 3.1.0在他们的官方网站上使用教程在QT Creator 4.4.1中工作。

Right now, I'm setting up my project file. 现在,我正在设置我的项目文件。 The whole file looks identical to the on in the tutorial apart from the last couple of lines, as my openCV build is in another place and it's a different version This is what I got: 除了最后几行之外,整个文件看起来与教程中的on相同,因为我的openCV构建在另一个地方而且它是一个不同的版本这就是我得到的:

INCLUDEPATH += C:\opencv\opencv-3.1.0\build\include

LIBS += -LC:\opencv\opencv-3.1.0\build\x64\vc14\bin \
    libopencv_world310d \

As far as I understand, the "world" module has been introduced to openCV to unify all the different modules into one. 据我所知,“world”模块已经引入openCV,将所有不同的模块统一为一体。

However, when I try to run this, QT produces the following error: 但是,当我尝试运行它时,QT会产生以下错误:

C:\opencv\opencv-3.1.0\build\x64\vc14\bin\opencv_world310d.dll:-1: error: file not recognized: File format not recognized

What am I doing wrong? 我究竟做错了什么? In the tutorial there's an alternative way to link the libraries which even explicitly states them as .dll files. 在本教程中,有一种链接库的替代方法,甚至可以明确地将它们表示为.dll文件。 Why is this a problem? 为什么这是个问题?

You need to link to the .lib contained in the lib folder: 您需要链接到lib文件夹中包含的.lib

LIBS += -LC:\opencv\opencv-3.1.0\build\x64\vc14\lib \

and put the .dll in the PATH, or the same folder of the .exe 并将.dll放在PATH或.exe的同一文件夹中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM