Note that there are some explanatory texts on larger screens.

plurals
  1. POusing static libraries instead of dynamic libraries in opencv
    text
    copied!<p>I have a project in visual studio 2012 which uses opencv dynamic libraries. It compiled, linked and worked well.</p> <p>I want to change the project so it uses static libraries instead of dynamic libraries.</p> <p>I changed the library directories in project VC++ directory from </p> <pre><code> C:\thirdparty\opencv\build\x86\vc11\lib </code></pre> <p>to: C:\thirdparty\opencv\build\x86\vc11\staticlib </p> <p>but when I want to build the project, I am getting a lot of linker error such as:</p> <pre><code> Error 110 error LNK2001: unresolved external symbol _TIFFWriteScanline myproject\opencv_highgui245.lib(grfmt_tiff.obj) </code></pre> <p>and more importantly a lot of error such as this:</p> <pre><code> Error 1 error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in myproject.obj myproject\opencv_core245.lib(system.obj) </code></pre> <p>What other changes should I do to convert a project which uses dynamic libraries to use static libraries?</p> <p><strong>Edit 1</strong></p> <p>After change /md to /mt and adding some new libraries to the list of input libraries:</p> <pre><code>opencv_calib3d245.lib opencv_contrib245.lib opencv_core245.lib opencv_features2d245.lib opencv_flann245.lib libtiff.lib libpng.lib libjpeg.lib libjasper.lib IlmImf.lib zlib.lib opencv_gpu245.lib opencv_haartraining_engine.lib opencv_highgui245.lib opencv_imgproc245.lib opencv_legacy245.lib opencv_ml245.lib opencv_nonfree245.lib opencv_objdetect245.lib opencv_photo245.lib opencv_stitching245.lib opencv_ts245.lib opencv_video245.lib opencv_videostab245.lib </code></pre> <p>I am getting some new errors:</p> <pre><code>Error 9 error LNK2001: unresolved external symbol _AVIFileCreateStreamA@12 myproject\opencv_highgui245.lib(cap_vfw.obj) Error 8 error LNK2001: unresolved external symbol _AVIFileGetStream@16 myproject\opencv_highgui245.lib(cap_vfw.obj) Error 5 error LNK2001: unresolved external symbol _AVIFileInit@0 myproject\opencv_highgui245.lib(cap_vfw.obj) Error 7 error LNK2001: unresolved external symbol _AVIFileOpenA@16 myproject\opencv_highgui245.lib(cap_vfw.obj) </code></pre> <p>Apparently some library is missing, but which one?</p> <p><strong>Edit 2</strong> need to add more library to list. Full list of library is as follow:</p> <pre><code>opencv_calib3d245.lib opencv_contrib245.lib opencv_core245.lib opencv_features2d245.lib opencv_flann245.lib libtiff.lib libpng.lib libjpeg.lib libjasper.lib IlmImf.lib zlib.lib opencv_gpu245.lib opencv_haartraining_engine.lib opencv_highgui245.lib opencv_imgproc245.lib opencv_legacy245.lib opencv_ml245.lib opencv_nonfree245.lib opencv_objdetect245.lib opencv_photo245.lib opencv_stitching245.lib opencv_ts245.lib opencv_video245.lib opencv_videostab245.lib Vfw32.Lib comctl32.lib </code></pre> <p>This solved the problem.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload