OpenCV and Visual Studio 2015, the hard way
Many computer vision projects rely on OpenCV. If you want to get going with OpenCV with Visual Studio on Windows without taking the easy route of just getting a NuGet package (maybe you want a specific version or a fork…), this article is meant to remind you (and me) what you need to do.
Download and install
Download the Windows version of OpenCV available on the official website.
Extract it to a trusted place on your disk. I prefer to keep it on the root of one of my drives.
Setting the environment variables
To make the set up of any future project as easy as possible, you need to set the path to set an environment variable for the OpenCV install directory:
You also have to add the OpenCV binaries to the path:
Configuration of your Visual Studio project
Create a new Visual C++ Project, an Empty Project is a fine fine to starting point.
Access the solution properties from the Solution Explorer pane:
Before modifying anything in the Property Pages, make you are making the modifications to the proper configuration:
Add the additional includes directories from the C/C++ -> General page:
From the Linker -> General page, add the library directories:
In the Linker -> Input page, set the additional dependencies:
Depending of the version of OpenCV and your compiler, you might need to set the _CRT_SECURE_NO_WARNINGS flag from the C/C++ -> Preprocessor page.
That is all.