Problem with .dll when trying to run simple demo example

Hello,

I have troubles running the simple example on this page:

https://docs.opencv.org/4.x/dd/d6e/tutorial_windows_visual_studio_opencv.html

The project is build successfully but when I hit the run button in both Debug and Release configurations I get this message “A dependent dll was not found” and the screen
says that the .dll in question is OpenCV_core470d.dll (or …core470.dll for release configuration correspondently). I guess this will happen for no matter which dll.

Any help on this?

Thanks in advance!

So many options. Given that opencv_core470d.dll etc. are contained in BUILD_DIR/bin and lets say your running opencv_example.exe you could:

  1. Change the Debugging command to point to the version in the bin directory. e.g. Replace $(TargetPath) in Properties->Debugging->Command with BUILD_DIR/bin/opencv_example.exe
  2. Add BUILD_DIR/bin to the Working Directory. e.g. Replace $(ProjectDir) in Properties->Debugging->Working Directory with BUILD_DIR/bin
  3. Add BUILD_DIR/bin to your user (need to restart Visual Studio) or system (need to restart windows) path variable either in the command line (set) or GUI (search Edit the System Environment Variables).

Hi @cudawarped, the last approach seems to be the best according to me, I will give it a try.
Thanks again!

Warning
This tutorial can contain obsolete information.