0

I want to create a simple application with a few static libraries from OpenCV. I managed to link all necessary .lib files, including opencv_world300d.lib, but at run-time it requires the opencv_world300d.dll. I can add the directory where this DLL is, but I just want a single .exe (no additional files). I clicked everywhere the option \MT or \MTd (no dlls) How can I achieve this? It is for x86, visual studio 2012 (v110) and OpenCV, version 3.0.0. In the lib file there is a reference to the dll, unfortunately.

  • Then you need to build opencv as a static library (if possible - I have not tested that). The lib you link to is an import library (that requires a dll). – drescherjm Jan 31 '16 at 13:58
  • 3
    You need to take your .lib from _/OPENCV_DIR/build/..... /staticlib_ folder, not _lib_ folder. Have a look at [this](http://stackoverflow.com/a/31545237/5008845) – Miki Jan 31 '16 at 14:00
  • http://stackoverflow.com/questions/3573475/how-does-the-import-library-work-details – drescherjm Jan 31 '16 at 14:01

1 Answers1

0

OpenCV application on MS visual studio c++ needs a DLL?

Not necessarily. You can link to OpenCV static libraries, which are in the folder staticlib, under OPENCV_DIR/build/.../staticlib.

The libraries in the lib folder are for dynamic linking, so you need also the .dll.

You can have a look at this answer for the step-by-step configuration.

Community
  • 1
  • 1
Miki
  • 40,887
  • 13
  • 123
  • 202