Download OpenCV on this site link and choose Windows. After downloading, install it on C:/.
C:/
In Properties, under C/C++ → General → Additional Include Directories, enter the following paths:
C:\opencv\build\include
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.
In Linker → General → Additional Library Directories, enter the following path:
C:\opencv\build\x64\vc16\lib
In Linker → Input → Additional Dependencies, add the following libs from the path C:\\opencv\\build\\x64\\vc16\\lib :
opencv_world4110d.lib
opencv_world4110.lib
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)"
OR: You can copy them manually :D