问题描述
每当我尝试在Visual Studio 2013中编译项目时,将附加库目录设置为$(OPENCV_DIR)\ staticlib,就会收到以下错误,在不同的OpenCV文件中重复41次:
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:
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.
我的OPENCV_DIR设置为C:\opencv\build\x86\vc11
.
My OPENCV_DIR is set to C:\opencv\build\x86\vc11
.
推荐答案
标准库实现在Visual Studio的不同版本之间不兼容,并且您似乎正在尝试使用VS2012编译的OpenCV版本VS2013.
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.
MSDN描述了这种情况在VS2012的Visual C ++的重大更改"中,尽管VS2013尚未特别提及.从该页面引用:
MSDN describes the situation in the "Breaking Changes" for Visual C++ in VS2012 although it's not specifically mentioned yet for VS2013. Quoting from that page:
要解决此问题,您将需要先使用VS2013重建OpenCV静态库,然后尝试与VS2013应用程序链接.
To overcome this, you will need to rebuild OpenCV static libraries using VS2013 first, then try linking with your VS2013 application.
这篇关于通过静态链接到OpenCV(C ++)在VS2013中编译项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!