在 Visual Studio 2015 中设置 OpenCV 3.1 [英] Setting up OpenCV 3.1 in Visual Studio 2015
问题描述
我已经下载了 opencv 3.1,我想在 Visual Studio 2015 中启动一个项目.我不知道如何将这个库链接到我的项目.另外我想知道我是否可以继续使用这个 opencv,因为它只有一个 x64 并且我的项目不针对 64 位系统.
I've downloaded opencv 3.1 and I want to start a project in Visual Studio 2015. I don't know how to link this library to my project. Also I want to know if I can continue with this opencv cause it just have a x64 and my project doesn't target on 64bits systems.
推荐答案
为 windows 下载 opencv 3.1
Download opencv 3.1 for windows
解压到c:/opencv
通过setx -m
设置环境变量.这取决于您的路径.
Set environment variables by setx -m
. This depends on your path.
在 cmd 启动的命令行中输入这个.
Type this into command line started by cmd.
setx -m OPENCV_DIR C:\opencv\build\x64\vc14
在路径编辑器中,在 control_panels/system/advanced/environmental_variables 下只需设置
In the path editor, under control_panels/system/advanced/environmental_variables just set
%OPENCV_DIR%\bin
%OPENCV_DIR%\bin
这些是重要的步骤.如果在 Visual Studio 中包含没有此项目的 Opencv 项目会失败,因为该项目找不到 DLL 库.
These are important steps. If you include Opencv project without this Project in visual studio failes because the project can not find DLL library.
在 Visual Studio 中的项目设置下
Under Project settings in Visual Studio
C/C++/General 集附加包含目录和附加#using目录.例如
C:\opencv\build\include
在链接器/常规设置附加库目录下,您可以使用在安装过程中设置的系统路径,或者为 64 位版本简单地包含此路径.例如 C:\opencv\build\x64\vc14\lib
或 C:\opencv\build\yourTarget\vc14\lib
Under Linker/general set Additional library directories you can use your system path set in installation process or simply include this path for 64 bit version. For example C:\opencv\build\x64\vc14\lib
or C:\opencv\build\yourTarget\vc14\lib
在链接器/输入下将附加依赖项设置为opencv_world310.lib
、opencv_world310d.lib
Under Linker/Input set Additional Dependencies as opencv_world310.lib
, opencv_world310d.lib
我的 Visual Sturio 2015 和 Opencv 教程3.1
这篇关于在 Visual Studio 2015 中设置 OpenCV 3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!