This is not a new thing actually, and as far as I remember this is my second time configuring this. However, I found problem on myself ūüėź I keep forgeting how to configure and connect openCV library with VS2015, especially in C++ language. As we know the environment is different than C# environment. So I decided to create one post for my own documentation. Because everytime I tried new installation, I keep facing the similar error but I forgot how to solve it and ended up with googling over the same problem so many time.

Configuring OpenCV 3.1 with VS2015

  1. Assume that you’ve installed VS2015
  2. Download the newest OpenCV library from here. In my case version 3.1 in .exe format.
  3. Extract the .exe file by clicking it.
  4. Copy the extracted file into C:// drive
  5. Configure the windows environment variable (System Properties -> Advances system settings -> Environment Variable…):
    1. Add new variable OPENCV_DIR with Value the directory of VC14 bin (C:\opencv\build\x64\vc14\bin)
    2. Add value to “Path” variable with¬†C:\opencv\build\x64\vc14\bin


Calling the openCV library from VS2015 IDE

If you decide to use C++, you have to setting the properties everytime you create new project. To make it easy, create property sheet so that you can import it for other project.

  1. Create Property Sheet for OpenCV 3.1
    1. Click View -> Other Windows -> Property Manager
    2. Right Click in the Project Name -> Add New Project Property Sheet
    3. Give it name, for me OpenCV3.1
  2. Setting VC++ Directories
    1. Include Directories : C:\opencv\build\include
    2. Library Directories: C:\opencv\build\x64\vc14\lib
  3. Setting Linker
    1. Click Input -> Additional Dependencies -> Add opencv_world310d.lib (for Debug)


Testing OpenCV Hello World

Write following code to test whether it has been linked or not. Put your tested image into your project folder to make it easy, or change the imread directory as per your image location.

#include "stdafx.h"
#include <opencv2\core.hpp>
#include <opencv2\highgui\highgui.hpp>

int main(int argc, char** argv)
	cv::Mat image;
	image = cv::imread("takanyan.jpg");
	return 0;

Voila~ done.


  • Cannot find or open the PDB file

Change the Setting of Microsoft Symbol. Tools -> Options -> Debugging -> Symbols and check “Microsoft Symbol Servers”

  • Target Platform related error

Change the target platform into x64


Leave a Reply