Qt试图包含openCV库文件

时间:2012-09-30 09:23:19

标签: qt opencv

我是否正确包含目录中的所有库文件?

LIBS += "C:\openCV24\opencv_bin\lib\*.dll"

因为这条线不断给我

C:\openCV24\opencv_bin\install\lib*.dll: Invalid argument

我试过看了几个地方并多次改变这条线但似乎无法让它起作用。如果我错过了一步,有人可以告诉我吗?

我已经包含了includepath,并且工作正常INCLUDEPATH += "C:\openCV24\opencv_bin\install\include"但是它的其他库文件会引发错误

很多人真的生气了

1 个答案:

答案 0 :(得分:1)

Pro文件中的Libs选项不适用于Dll文件,它适用于lib文件。尝试LIBS + =“C:\ openCV24 \ opencv_bin \ lib \ * .lib”。此外,“* .lib”使用可能会因链接顺序而导致问题。

<强>更新 这是我的OPENCV专业文件模板。您还应该在路径中添加opencv bin文件夹。

#begin{opencv}
INCLUDEPATH += "C:\opencv\opencv\build\include"
INCLUDEPATH += "C:\opencv\opencv\build\include\opencv"

LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_calib3d231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_contrib231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_core231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_features2d231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_flann231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_gpu231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_haartraining_engine.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_highgui231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_imgproc231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_legacy231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_ml231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_objdetect231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_ts231.lib
LIBS += C:\opencv\opencv\build\x86\vc9\lib\opencv_video231.lib
#end{opencv}