Search code examples
c++visual-studiolinker-errorslibraries

Visual studio trying to find dll when lib file was given


I am trying to setup OpenCV on Visual Studio 2022. I have included the "include" folder and "lib" folder in include and library directories. I specified "opencv_world480d.lib" in the additional dependencies for the debugging version but when I run the debugger I get an error window saying "opencv_world480d.dll was not found". I want to use the static library, is there a setting in where I have to switch so that VC will use a static library? This is my first time using a library and from what I know only the lib file is needed for static library?

additional dependencies setting error code

I have tried adding the include and library directories locally and tested "opencv_world480.lib" instead of the debug version. VC still tried to find a dll file.


Solution

  • opencv_world480d.dll was not found
    

    You need to put the dll in the same folder as generated exe. The dll is in opencv's x64 -> <version> -> bin folder.

    To use static lib, make sure x64-windows-static opencv is installed. And the lib name is different. enter image description here