Visual studio 2015 configuring opencv3.2


This article focuses on how to configure opencv3.2 in Visual Studio 2015

The example uses win 10 system + Visual Studio 2015 + opencv 3.2

1、 Download opencv 3.2

Opencv website:

Please select the corresponding

Or you can download it from GitHub:

2、 Unzip opencv

Download the EXE file like this

Double click the file and you will see the following dialog box

The decompression path here is free and irrelevant. You can just put it where you want,

Click extract to start decompression

During decompression

After unzipping, open the unzipping path, and you will see that there is an opnecv folder in the folder

Generally, I will copy or cut this folder to the root directory of the system disk, for example, C:\

I think it will be more convenient,

Where to put it depends on your personal preference, but Chinese characters should be avoided on the path to avoid unnecessary mistakes

3、 Add environment variable

“My computer” right click – > pop up system dialog box click “advanced system settings” – > pop up system properties dialog box click “environment variable”

As shown in the figure below

In the environment variable dialog box, locate the path variable in the system variable list and click the Edit button to edit it

The following picture:

Click New in the pop-up edit dialog box to add the bin directory path of opencv

Following chart

Add it, press OK, and then press OK

Just add the path and copy it directly, so it won’t make any mistakes

4、 Vs2015 new project

First, we open vs2015 and do the following

In the pop-up dialog box of new project, we choose the 32-bit console application of VC + +, the name below is just as good as you like, and I will not make any changes.

The following picture:

Then we will see some settings of the project. First, we will press the next step

Next, we want to create an empty item. Please tick it and press finish.

Project has been established

Following pictures

5、 Project opencv configuration

Open property manager

In the “attribute manager” — > select “release” x64 “and right click — > select” attribute “

1. Set the C / C + + — > General — > additional include directory, and click Edit to set it

Add three directories such as include and click OK

2. Set the linker general additional library directory, and click Edit to set it

Add the path of Lib directory and click OK

3. Set the linker input additional dependency, and click Edit to set it

Add “opencv_world320. Lib” image suffix error, please correct yourself, thank you for your cooperation.

The above file is in the following directory. You can copy the file name directly to avoid errors caused by input

4. Set the definition of C / C + + preprocessor and click Edit to set it

Add “CRT” security “no” warnings statement, as shown below

6、 New test program file (. Cpp file)

In the “source file” folder, right-click to pop up and select “add” — > new item “

In the Add New Item dialog box, select “C + + file (. CPP)”. I am used to source the file name. Click Add to finish the creation.

7、 The source code is as follows

#include <iostream> 
#include <opencv2\opencv.hpp> 
using namespace std; 
int main() 
 cout << CV_MAJOR_VERSION << endl; 
 return 0; 

Eight, debugging

Remember to set “release” and “x64” and then click “local windows debugger”

Set a breakpoint on line 9, and you will see the following effect when you run debugging

If you can see the above, the configuration is successful,

The above is the whole content of this article. I hope it will help you in your study, and I hope you can support developepaer more.