简体   繁体   中英

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:

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 .

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 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:

MSDN

To overcome this, you will need to rebuild OpenCV static libraries using VS2013 first, then try linking with your VS2013 application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM