C++ 在 Visual Studio 2013 中使用 opencv

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19464028/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 22:51:04  来源:igfitidea点击:

using opencv with visual studio 2013

c++opencvvisual-studio-2012

提问by smttsp

I have opencv 2.4.6 installed to my machine and want to use it with visual studio 2013 which is also installed.

我已将 opencv 2.4.6 安装到我的机器上,并希望将它与已安装的 Visual Studio 2013 一起使用。

After doing regular configurations I faced with

在进行常规配置后,我遇到了

1>opencv_core246d.lib(alloc.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in main.obj

and many others similar to this error.

以及许多其他与此错误类似的错误。

I find this questionwhich is similar to my problem. The accepted answer says to me to change opencv but I couldnt find opencv for visual studio 2013. The second answer didn't help at all.

我发现这个问题与我的问题相似。接受的答案告诉我要更改 opencv,但我找不到 Visual Studio 2013 的 opencv。第二个答案根本没有帮助。

Is there any other way to solve this problem or should I change my visual studioto 2012?

有没有其他方法可以解决这个问题,或者我应该更改visual studio2012

Thanks in advance.

提前致谢。

回答by joshlk

I was getting the same errors. Are you on a 64-bit machine? I solved the problem by following instructions for installing opencv for 64bit programs.

我遇到了同样的错误。你是 64 位机器吗?我按照为 64 位程序安装 opencv 的说明解决了这个问题。

Check out this tutorial: http://www.anlak.com/using-opencv-2-4-x-with-visual-studio-2010-tutorial/

查看本教程:http: //www.anlak.com/using-opencv-2-4-x-with-visual-studio-2010-tutorial/

But it only works if you run the programs in release mode!

但它只有在您以发布模式运行程序时才有效!

回答by Bull

If you want to use VS2013 with OpenCV you need to use OpenCV 2.4.7.2 (or better). See http://opencv.org/opencv-2-4-7-2-for-windows-release.html

如果您想在 OpenCV 中使用 VS2013,您需要使用 OpenCV 2.4.7.2(或更好)。见http://opencv.org/opencv-2-4-7-2-for-windows-release.html

This release contains fixes and improvements mostly in OpenCL-related stuff (‘ocl' module) and a fix for compilation with VS 2013.

此版本包含主要在 OpenCL 相关内容('ocl' 模块)中的修复和改进,以及使用 VS 2013 进行编译的修复。

回答by lolando

In visual studio 2013, it should be possible to use the compiler & linker of VS2012 (VC11).
In Configuration Properties> General> Platform Tool Set, do you have v110in the drop down list? If yes, select it and your executable will be compiled and linked using the tools of VS2012

在 Visual Studio 2013 中,应该可以使用 VS2012 (VC11) 的编译器和链接器。
Configuration Properties> General> 中Platform Tool Set,您是否v110在下拉列表中?如果是,选择它,您的可执行文件将使用 VS2012 的工具进行编译和链接