Error opencv_world420d.dll was not found

The following error appears:

The code execution cannot proceed because opencv_world420d.dll was not found. Reinstalling the program may fix this problem.

I tried reinstalling the program but nothing changed.

you have to add the folder with the opencv binaries to the PATH environment variable, so your program can find the dll at runtime

Have you checked BUILD_opencv_world flag in your cmake file? Otherwise opencv_world420.dll will not be created, the build will create seperated dlls (improc., core, highgui etc.)