0

I try to run OpenCV on my computer (Windows 7, Visual Studio 2013 Express). I follow these tutorials from official site:

http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html http://docs.opencv.org/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html

But when i try to run an example i got an error:

error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

I found a topic on Stack about this problem: https://stackoverflow.com/a/4364020/2667715 I changed build configuration from x86 to x64 platform (second point in the indicated answer), but it results in a lots of (560) different errors. For example:

Error   1   error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in Source.obj  C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(alloc.obj)   OpenCVTest
Error   2   error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Source.obj C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(alloc.obj)   OpenCVTest
Error   3   error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in Source.obj  C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(stl.obj) OpenCVTest
Error   4   error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Source.obj C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(stl.obj) OpenCVTest
Error   5   error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in Source.obj  C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(matrix.obj)  OpenCVTest
Error   6   error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Source.obj C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(matrix.obj)  OpenCVTest
Error   7   error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in Source.obj  C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(opencv_core_pch.obj) OpenCVTest
Error   8   error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Source.obj C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(opencv_core_pch.obj) OpenCVTest
Error   9   error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in Source.obj  C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(system.obj)  OpenCVTest
Error   10  error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Source.obj C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(system.obj)  OpenCVTest

Help will be really appreciated.

Edit: After changing Runtime Library to Mutlithreaded Debug (\MTd) (user4581301 comment) errors were slightly reduced (to 410). For example:

Error   1   error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in Source.obj  C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(alloc.obj)   OpenCVTest
Error   2   error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in Source.obj  C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(stl.obj) OpenCVTest
Error   3   error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in Source.obj  C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(matrix.obj)  OpenCVTest
Error   34  error LNK2005: "public: __cdecl Concurrency::details::_StructuredTaskCollection::~_StructuredTaskCollection(void)" (??1_StructuredTaskCollection@details@Concurrency@@QEAA@XZ) already defined in opencv_core300d.lib(parallel.obj) C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\LIBCMTD.lib(TaskCollection.obj)  OpenCVTest
Error   35  error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::imread(class cv::String const &,int)" (?imread@cv@@YA?AVMat@1@AEBVString@1@H@Z) referenced in function main    C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\Source.obj   OpenCVTest
Error   36  error LNK2019: unresolved external symbol ippicvsFlip_16u_I referenced in function "enum IppStatus (__cdecl*__cdecl cv::getFlipFunc(int))(void *,int)" (?getFlipFunc@cv@@YAP6A?AW4IppStatus@@PEAXH@ZH@Z)    C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(matrix.obj)  OpenCVTest
Error   37  error LNK2019: unresolved external symbol ippicvsFlip_32f_I referenced in function "enum IppStatus (__cdecl*__cdecl cv::getFlipFunc(int))(void *,int)" (?getFlipFunc@cv@@YAP6A?AW4IppStatus@@PEAXH@ZH@Z)    C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(matrix.obj)  OpenCVTest
Error   231 error LNK2019: unresolved external symbol ippicviNorm_L2_8u_C3R referenced in function "double __cdecl cv::norm(class cv::_InputArray const &,int,class cv::_InputArray const &)" (?norm@cv@@YANAEBV_InputArray@1@H0@Z) C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(stat.obj)    OpenCVTest
Error   232 error LNK2019: unresolved external symbol ippicviNorm_L2_8u_C4R referenced in function "double __cdecl cv::norm(class cv::_InputArray const &,int,class cv::_InputArray const &)" (?norm@cv@@YANAEBV_InputArray@1@H0@Z) C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(stat.obj)    OpenCVTest
Error   233 error LNK2019: unresolved external symbol ippicviNorm_L2_16s_C1R referenced in function "double __cdecl cv::norm(class cv::_InputArray const &,int,class cv::_InputArray const &)" (?norm@cv@@YANAEBV_InputArray@1@H0@Z)    C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(stat.obj)    OpenCVTest
Error   234 error LNK2019: unresolved external symbol ippicviNorm_L2_16s_C3R referenced in function "double __cdecl cv::norm(class cv::_InputArray const &,int,class cv::_InputArray const &)" (?norm@cv@@YANAEBV_InputArray@1@H0@Z)    C:\Users\Tomek\documents\visual studio 2013\Projects\OpenCVTest\OpenCVTest\opencv_core300d.lib(stat.obj)    OpenCVTest

Edit2:

I made some changes in linker dependencies and now i can build my project. But after the start i get an error:

The program can't start because opencv_world300d.dll is missing from your computer.

Mentioned library is in OpenCV bin folder. I added location of that folder to PATH variable and copied file to Debug folder of project but nothing has changed.

Community
  • 1
  • 1
Zuku
  • 1,030
  • 13
  • 21
  • I'd drop the bit about the initial error from your question because it looks like you've solved that correctly. The second part looks like you need to go into properties-> Configuration Properties->C/C++->Code Generation and change Runtime Library to (I think) Mutlithreaded Debug \MTd. – user4581301 Sep 12 '15 at 18:33
  • @user4581301 Unfortunatelly it didn't change much. Only reduced a little number of errors (to 410). – Zuku Sep 12 '15 at 18:54
  • Remaining errors pretty much the same as the last? Post a couple. – user4581301 Sep 12 '15 at 19:10
  • @user4581301 I added them to the post. – Zuku Sep 12 '15 at 19:24
  • Ig. Sorry I didn't warn you about one of those the first time. The three are covered by this: http://stackoverflow.com/questions/19575747/error-lnk2038-mismatch-detected-for-msc-ver-value-1600-doesnt-match-valu – user4581301 Sep 12 '15 at 19:30
  • The rest are missing libraries. properties-> Configuration Properties->VC++ Directories add your openCV library folders to Library Directories. You may also have to specify the libraries by going to properties-> Configuration Properties->Linker and adding them to Additional Dependencies – user4581301 Sep 12 '15 at 19:36
  • @user4581301 Thanks, i was using libraries for VS 2012 by mistake. I changed them to proper version so part of the errors is resolved. Unfortunatelly others still occur. I added library folder to Library Directories but it didn't help. To linker's dependencies libraries was already added. – Zuku Sep 12 '15 at 20:00
  • Somewhere out there you are missing at least one library. See if this is any help: http://stackoverflow.com/questions/28624644/opencv-linking-error-win32-vs2012 – user4581301 Sep 12 '15 at 20:09
  • @user4581301 Indeed, you were right. There was a problem with libraries in linker. It seems that OpenCV tutorials about Windows are a little deprecated and now libs structure looks slightly different. Anyway I can build my project now, but there's problem with opencv_world300d.dll. I updated my post. – Zuku Sep 12 '15 at 22:45

0 Answers0