VS2013+Qt5.6.0+opencv3.0环境配置

一、安装软件 
1、首先下载安装VS2013 
2、下载 visual studio Add-in 1.2.5 for Qt5 和Qt5.6.0 for Windows,下载地址http://www.qt.io/download-open-source/ 
3、安装visual studio Add-in和Qt5.6.0,这里比较简单,只要一直next就可以了。 
4、安装opencv,只要直接下载下来解压就可以,我这里的版本是3.0 
二、环境配置 
1、打开VS,打开QT5->QT Options,点击Add加入QT下面的msvc2013目录。 
VS2013+Qt5.6.0+opencv3.0环境配置_第1张图片

VS2013+Qt5.6.0+opencv3.0环境配置_第2张图片

2、新建一个Qt项目,new->project,选择Qt Application,输入名字后,点击OK,然后直接点finish就好了。 
VS2013+Qt5.6.0+opencv3.0环境配置_第3张图片

3、点击Property Manager->Debug|64->Microsoft.Cpp.x64.user,注意这里是要配置64位的,可能是因为Qt的编译器是64位的,之前配置成32位的,在Qt项目中使用opencv一直不成功,而且这里的环境的话32位和64位只能配置一个,不然编译器会混乱,同样会出现错误。 
VS2013+Qt5.6.0+opencv3.0环境配置_第4张图片

双击打开Microsoft.Cpp.x64.user在C/C++->General->Additional Include Directories中加入Qt下的include路径。 
VS2013+Qt5.6.0+opencv3.0环境配置_第5张图片

4、配置Qt和opencv的库文件 
打开Microsoft.Cpp.x64.user->VC++ Directories 
(1)在Include Directories中加入opencv文件夹中的include文件夹和include下面的opencv和opencv2 
(2)在Library Directories中加入opencv文件夹中x64下v12中的lib和staticlib文件夹,注意这里是x64,具体原因上面说了,这里v12对应VS2013。 
VS2013+Qt5.6.0+opencv3.0环境配置_第6张图片

打开Microsoft.Cpp.x64.user->Linker->Input,在Additional Dependencies中加入链接文件,其中加后面d的为debug文件,不加d的为release文件,这里debug文件应该在release文件前面。

VS2013+Qt5.6.0+opencv3.0环境配置_第7张图片

这里我添加的如下,不是很清楚要添加哪些,就把所有的都填上去了,Qt的应该可以不用添加
opencv_ts300d.lib 
opencv_world300d.lib 
IlmImfd.lib 
libjasperd.lib 
libjpegd.lib 
libpngd.lib 
libtiffd.lib 
libwebpd.lib 
opencv_calib3d300d.lib 
opencv_core300d.lib 
opencv_features2d300d.lib 
opencv_flann300d.lib 
opencv_hal300d.lib 
opencv_highgui300d.lib 
opencv_imgcodecs300d.lib 
opencv_imgproc300d.lib 
opencv_ml300d.lib 
opencv_objdetect300d.lib 
opencv_photo300d.lib 
opencv_shape300d.lib 
opencv_stitching300d.lib 
opencv_superres300d.lib 
opencv_video300d.lib 
opencv_videoio300d.lib 
opencv_videostab300d.lib 
zlibd.lib 
libEGLd.lib 
libGLESv2d.lib 
Qt5AxBased.lib 
Qt5AxContainerd.lib 
Qt5AxServerd.lib 
Qt5Bluetoothd.lib 
Qt5Clucened.lib 
Qt5Concurrentd.lib 
Qt5Cored.lib 
Qt5DBusd.lib 
Qt5DesignerComponentsd.lib 
Qt5Designerd.lib 
Qt5Guid.lib 
Qt5Helpd.lib 
Qt5LabsControlsd.lib 
Qt5LabsTemplatesd.lib 
Qt5Locationd.lib 
Qt5Multimediad.lib 
Qt5MultimediaQuick_pd.lib 
Qt5MultimediaWidgetsd.lib 
Qt5Networkd.lib 
Qt5Nfcd.lib 
Qt5OpenGLd.lib 
Qt5OpenGLExtensionsd.lib 
Qt5PlatformSupportd.lib 
Qt5Positioningd.lib 
Qt5PrintSupportd.lib 
Qt5Qmld.lib 
Qt5Quickd.lib 
Qt5QuickParticlesd.lib 
Qt5QuickTestd.lib 
Qt5QuickWidgetsd.lib 
Qt5Scriptd.lib 
Qt5ScriptToolsd.lib 
Qt5Sensorsd.lib 
Qt5SerialBusd.lib 
Qt5SerialPortd.lib 
Qt5Sqld.lib 
Qt5Svgd.lib 
Qt5Testd.lib 
Qt5UiToolsd.lib 
Qt5WebChanneld.lib 
Qt5WebEngineCored.lib 
Qt5WebEngined.lib 
Qt5WebEngineWidgetsd.lib 
Qt5WebSocketsd.lib 
Qt5WebViewd.lib 
Qt5Widgetsd.lib 
Qt5WinExtrasd.lib 
Qt5Xmld.lib 
Qt5XmlPatternsd.lib 
Qt53DCored.lib 
Qt53DInputd.lib 
Qt53DLogicd.lib 
Qt53DQuickd.lib 
Qt53DQuickInputd.lib 
Qt53DQuickRenderd.lib 
Qt53DRenderd.lib 
qtfreetyped.lib 
qtmaind.lib 
opencv_ts300.lib 
opencv_world300.lib 
IlmImf.lib 
ippicvmt.lib 
libjasper.lib 
libjpeg.lib 
libpng.lib 
libtiff.lib 
libwebp.lib 
opencv_calib3d300.lib 
opencv_core300.lib 
opencv_features2d300.lib 
opencv_flann300.lib 
opencv_hal300.lib 
opencv_highgui300.lib 
opencv_imgcodecs300.lib 
opencv_imgproc300.lib 
opencv_ml300.lib 
opencv_objdetect300.lib 
opencv_photo300.lib 
opencv_shape300.lib 
opencv_stitching300.lib 
opencv_superres300.lib 
opencv_video300.lib 
opencv_videoio300.lib 
opencv_videostab300.lib 
zlib.lib 
libEGL.lib 
libGLESv2.lib 
Qt5AxBase.lib 
Qt5AxContainer.lib 
Qt5AxServer.lib 
Qt5Bluetooth.lib 
Qt5Bootstrap.lib 
Qt5Clucene.lib 
Qt5Concurrent.lib 
Qt5Core.lib 
Qt5DBus.lib 
Qt5DesignerComponents.lib 
Qt5Designer.lib 
Qt5Gui.lib 
Qt5Help.lib 
Qt5LabsControls.lib 
Qt5LabsTemplates.lib 
Qt5Location.lib 
Qt5Multimedia.lib 
Qt5MultimediaQuick_p.lib 
Qt5MultimediaWidgets.lib 
Qt5Network.lib 
Qt5Nfc.lib 
Qt5OpenGL.lib 
Qt5OpenGLExtensions.lib 
Qt5PlatformSupport.lib 
Qt5Positioning.lib 
Qt5PrintSupport.lib 
Qt5Qml.lib 
Qt5QmlDevTools.lib 
Qt5Quick.lib 
Qt5QuickParticles.lib 
Qt5QuickTest.lib 
Qt5QuickWidgets.lib 
Qt5Script.lib 
Qt5ScriptTools.lib 
Qt5Sensors.lib 
Qt5SerialBus.lib 
Qt5SerialPort.lib 
Qt5Sql.lib 
Qt5Svg.lib 
Qt5Test.lib 
Qt5UiTools.lib 
Qt5WebChannel.lib 
Qt5WebEngineCore.lib 
Qt5WebEngine.lib 
Qt5WebEngineWidgets.lib 
Qt5WebSockets.lib 
Qt5WebView.lib 
Qt5Widgets.lib 
Qt5WinExtras.lib 
Qt5Xml.lib 
Qt5XmlPatterns.lib 
Qt53DCore.lib 
Qt53DInput.lib 
Qt53DLogic.lib 
Qt53DQuick.lib 
Qt53DQuickInput.lib 
Qt53DQuickRender.lib 
Qt53DRender.lib 
qtfreetype.lib 
qtmain.lib 
5、将opencv下x64\vc12\bin目录添加到环境变量,我的为D:\OpenCV\opencv\build\x64\vc12\bin。直接在path的后面添加bin的路径就好了,注意后面没有”;”。最后设置完环境变量需要重启下机器。 
VS2013+Qt5.6.0+opencv3.0环境配置_第8张图片VS2013+Qt5.6.0+opencv3.0环境配置_第9张图片

你可能感兴趣的:(计算机编程,QT)