OpenCV - missing dlls?

前端 未结 4 1110
灰色年华
灰色年华 2021-01-26 09:54

I am a beginner learning OpenCV. I have the latest version (2.4.7.2 as of Dec, 2013) and am trying a simple code to load image. The code is OK, but when I compiled and then run

4条回答
  •  时光说笑
    2021-01-26 10:22

    You are running into OpenCV dll issues, similar to here. Three ways to fix dll-related issues about OpenCV, also works for other dll related issues.

    1. copy the required dlls into the same folder with your application. This is a little better because it kind of prepares you for when you'll need to deploy your application on systems that don't have OpenCV installed (for then don't forget to build the release version of your application).

    2. add the dll path to Debugging Environment: Project –> Properties –> Configuration Properties –> Debugging –> Environment –> add dlls' paths here. The syntax is NAME=VALUE and macros can be used (for example, $(OutDir).

      • For example, to prepend C:\Windows\Temp to the PATH: PATH=C:\WINDOWS\Temp;%PATH%

      • Similarly, to append $(SolutionDir)\DLLS to the PATH: PATH=%PATH%;$(SolutionDir)\DLLS

    3. add the dll path to Environment Variables (be careful that the path in there are separated by ;)


    EDIT: Among the three methods, the first two will only work for this project (local) and the last one works for all projects in your PC (global).

提交回复
热议问题