Fix error

Fix opencv_world4120.dll not found on Windows — C++ DLL error guide

Fix the most common C++ OpenCV error on Windows: opencv_world4120.dll was not found. Add the bin directory to PATH or copy the DLL next to your executable.

What this error looks like

Windows error dialog or cmd.exe
The code execution cannot proceed because opencv_world4120.dll was not found.
Reinstalling the program may fix this problem.
The program can't start because opencv_world4120.dll is missing
from your computer.

This error occurs when running a C++ application that was built with OpenCV but Windows cannot find the opencv_world4120.dll file at runtime. The DLL exists on your machine — it just is not on the system PATH.

Add OpenCV bin directory to system PATH

  • 1

    Open System Environment Variables

    Press Win+S → search Edit the system environment variables → click Environment Variables.

  • 2

    Edit the system Path variable

    Under System variables (not User variables), find Path → click EditNew.

  • 3

    Add the OpenCV bin path

    Path to add
    C:\opencv\build\x64\vc16\bin
    # Adjust path if you extracted OpenCV to a different location

    Click OK on all dialogs. Restart your application (and Visual Studio if open).

  • 4

    Verify the DLL is found

    cmd.exe — new window
    C:\> where opencv_world4120.dll
    C:\opencv\build\x64\vc16\bin\opencv_world4120.dll

Copy the DLL next to your executable

An alternative that does not require modifying PATH: copy the DLL to the same folder as your compiled .exe:

cmd.exe
# Copy the DLL to your app folder:
C:\> copy "C:\opencv\build\x64\vc16\bin\opencv_world4120.dll" "C:\MyApp\build\Release\"
# Also copy the debug DLL if you use Debug builds:
C:\> copy "C:\opencv\build\x64\vc16\bin\opencv_world4120d.dll" "C:\MyApp\build\Debug\"
Copying the DLL next to the exe is the recommended approach for distribution — your app works without requiring users to set PATH.

Which DLL filename do I need?

OpenCV versionRelease DLLDebug DLL
4.12.0opencv_world4120.dllopencv_world4120d.dll
4.10.0opencv_world4100.dllopencv_world4100d.dll
4.9.0opencv_world490.dllopencv_world490d.dll

The DLLs are in C:\opencv\build\x64\vc16\bin\ after extracting the Windows installer.

DLL not found questions

I added to PATH but still getting the error
Restart your application completely — PATH changes only take effect in new processes. If using Visual Studio, close and reopen it. Also make sure you added to System variables Path, not User variables.
LNK1107: invalid or corrupt file opencv_world4120.lib
You are linking against the wrong lib file. Use opencv_world4120.lib for Release builds and opencv_world4120d.lib for Debug builds. Check that your project Configuration matches.
The DLL exists but the app still says not found
The DLL may have its own missing dependencies. Use the Dependencies tool to check all DLL dependencies. Also make sure you are not mixing 32-bit and 64-bit binaries.

Need to set up C++ from scratch?

Visual Studio configuration guide with include paths and linker settings.

C++ setup guide