OpenCV

Download OpenCV on this site link and choose Windows. After downloading, install it on C:/.

OpenCV download

In Properties, under C/C++ → General → Additional Include Directories, enter the following paths:

C:\opencv\build\include
OpenCV include paths

In C/C++ → Language → Conformance Mode, set the value to No (/permissive). This disables strict standard conformance and helps avoid issues with ambiguous namespaces in some libraries.

In C/C++ → Language → C++ Language Standard, choose C++17 or a newer version. This is required for modern libraries to compile correctly.

Language settings in Visual Studio

In Linker → General → Additional Library Directories, enter the following path:

C:\opencv\build\x64\vc16\lib
OpenCV libraries

In Linker → Input → Additional Dependencies, add the following libs from the path C:\\opencv\\build\\x64\\vc16\\lib :

  • For DEBUG
    opencv_world4110d.lib
  • For RELEASE
    opencv_world4110.lib
OpenCV libraries

In Build Events → Pre-Build Event → Command Line, add the following command:

xcopy /Y /C /I /Q "C:\opencv\build\x64\vc16\bin\*.dll" "$(OutDir)"
Pre-Build Command

OR: You can copy them manually :D