0. Download OpenCV
Download the required version and install it at https://opencv.org/releases/ ;
1. Add environment variables
Find the Path in the system variable and edit it. Add the bin path under the previously unzipped (installed) OpenCV path to the Path system environment variable.
Note that it is the bin path, mine is D:\opencv\build\x64\vc14\bin
2. Configure OpenCV in VS2015
The official download address of Visual Studio2015: https://visualstudio.microsoft.com/zh-hans/vs/older-downloads/
2.1. Create a project
Mouse click on File -> New -> Project
Use the shortcut key if you can’t find it, shortcut key: ctrl+shift+n
2.2 Create cpp file
Shortcut key: ctrl+shift+a
After the creation is completed, the configuration starts. I am running under Debug x64, so I will configure Debug x64 later.
3. Open the property manager
View -> Other Windows -> Property Manager
The property manager interface appears in the right column, click to open, and select Debug x64, right-click "Properties".
4. Add include directory
vc++ directory -> include directory -> select edit
Add the decompressed (installed) OpenCV path, which are include, include\opencv, include\opencv2, it is recommended to add all three
5. Add library directory
VC++ directory -> library directory Under the unzipped (installed) OpenCV path
6. Add additional dependencies
Linker -> Input -> Additional Dependencies Manually type opencv_world342d.lib
342 corresponds to OpenCV3.4.2. Other versions write and add by themselves.
Congratulations, the installation is now complete, so hurry up and develop the project.
Reprint link https://www.cnblogs.com/aiguona/p/9370433.html