[英]Compile a project in VS2013 with static linking to OpenCV (C++)
Whenever I try to compile my project in Visual Studio 2013, with the additional library directory set to $(OPENCV_DIR)\\staticlib, I get the following error, repeated 41 times across different OpenCV files: 每当我尝试在Visual Studio 2013中编译我的项目时,将其他库目录设置为$(OPENCV_DIR)\\ staticlib,我会收到以下错误,在不同的OpenCV文件中重复41次:
error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in main.obj
How would I go about fixing this? 我该如何解决这个问题? I'm assuming it's to do with compiler versions, but I don't know how to get it fixed.
我假设它与编译器版本有关,但我不知道如何修复它。
My OPENCV_DIR is set to C:\\opencv\\build\\x86\\vc11
. 我的OPENCV_DIR设置为
C:\\opencv\\build\\x86\\vc11
。
The standard library implementation is not compatible across different versions of Visual Studio and it looks like you have a version of OpenCV compiled with VS2012 that you're trying to link with VS2013. 标准库实现在不同版本的Visual Studio中不兼容,看起来你有一个用VS2012编译的OpenCV版本,你试图与VS2013链接。
MSDN describes the situation in the "Breaking Changes" for Visual C++ in VS2012 although it's not specifically mentioned yet for VS2013. MSDN描述了 VS2012中Visual C ++的“重大变化” 中的情况 ,尽管VS2013还没有特别提及。 Quoting from that page:
从该页面引用:
To overcome this, you will need to rebuild OpenCV static libraries using VS2013 first, then try linking with your VS2013 application. 要解决这个问题,首先需要使用VS2013重建OpenCV静态库,然后尝试使用VS2013应用程序进行链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.