OpenCV installation Tutorial, MS Visual C++ 2008

Installing OpenCV might sound very easy when you read it on some forums/websites, but there are some small changes in most of these tutorials that prevent the connection between OpenCV and MS Visual C++. In this tutorial we(my dear friend Puya Afsharian and I) try to guide you through the installation of these two products and the right way to make them talk with each other.

Although people say it is easy to make OpenCV 2.2 to work with MS Visual C++ 2010, but we did not get it to work properly while it seems that MS visual c++ 2008 works perfect with OpenCV 2.1. Here are the download links for both products :

OpenCV 2.1 :
This file is modified to work with MS Visual C++ 2008 and therefore there is no need to install CMake again.

MS Visual C++ 2008(Free of charge) :

Click More down here to read the rest of the tutorial …

1 – Installing OpenCV

After downloading OpenCV 2.1, you need to install the program. This is done by just running the EXE file which pops up the installation wizard. There you need to choose an installation path. I usually let it install to C:OpenCV2.1. We refer to this path as ~ after this. DON’T FORGET to add the path for all users.

2- Installing MS Visual C++ 2008

After downloading MS VC++ 2008, you need to install the program. This is done by just running the installation wizard which downloads the necessary files.

3- Link OpenCV and VC++ together

Open VC++. Then navigate to Tools > Options > Projects and Solutions > VC++ Directories.

On “Show directories for, choose : Include Files

Add the following : “~includeopencv”

On “Show directories for, choose : Library Files

Add the following : “~lib”

Choose “Show directories for: Source Files

Add the following :


Now we are done configuring VC++, but still we need some small changes in our project to be able to use OpenCV libraries

4- Project Configuration :

After creating the project, the OpenCV dependencies should be added.
Navigate to Open Project Properties: Project – %projectName% Properties
Open Linker Input properties: Configuration Properties > Linker > Input
Open the “…” window to edit “Additional Dependencies” and on each line put:


And any other lib file necessary for your project
Your project should now build. If you get any errors try restarting Visual Studio and then doing a clean Rebuild.