Installing & Configuring OpenCV2.1 with VS 2010

You can download the latest OpenCV library from its page. But for Windows 7, Windows Vista or Windows XP SP3 users, it is easy to download Latest OpenCV Windows executable (.exe) file and just double click it to install. 
Once you have completed installing, you need to change some settings in your IDE so that it knows where to find the library files and header files of OpenCV. I’ll demonstrate the configuring process of  Microsoft Visual Studio 2010. (The configuration process is same for  Microsoft Visual C++ 2010 Express Edition (free))

Steps to Configure Microsoft Visual Studio 2010
  • Start Microsoft Visual Studio 2010
  • Go to File>New>Project>Visual C++>Win32>Win32 Console Application. Enter a name, say "HelloWorld" for your application and then click OK

Creating Visual C++ Application
  • In Visual Studio 2008
    • Go to 'Tools > Options > Projects and Solutions'
  • In Visual Studio 2010
    • Go to 'Project > Properties'  or  'Project > Helloworld Properties'  
  • Don't forget to select Configurations as 'All Configurations' as illustrated below
  • In the left pane, click  'Configuration Properties>VC++ Directories'
    • In Include Directories, add 'C:\OpenCV2.1\include\opencv'
    • In Library Directories, add 'C:\OpenCV2.1\lib'
    • In Source Directories, add 'C:\OpenCV2.1\src\cv; C:\OpenCV2.1\src\cvaux; C:\OpenCV2.1\src\cxcore; C:\OpenCV2.1\src\highgui; C:\OpenCV2.1\src\ml'
Configuring Microsoft Visual Studio for OpenCV
  • In the left pane, Click  'Configuration Properties > Linker > Input'
    • In Additional Dependencies, add 'cv210.lib; cxcore210.lib; highgui210.lib; cvaux210.lib; ml210.lib '
Configuring Microsoft Visual Studio for OpenCV

Now you are ready to write your first computer vision program using the 'OpenCV' library with Visual C++.

Next Tutorial : OpenCV API

Previous Tutorial : What is OpenCV?


  1. Hi, can i know if i using the lastest version of open cv 2.4.3. Which file i need to include for the source directories?

    1. Please refer to It is explained how to configure the OpenCV2.4.5 with Visual Studio 2012.

  2. well thanks fro the tuto.
    i wonder where i can fine those directories :
    'C:\OpenCV2.1\src\cv; C:\OpenCV2.1\src\cvaux; C:\OpenCV2.1\src\cxcore; C:\OpenCV2.1\src\highgui; C:\OpenCV2.1\src\ml'

    i do not find a directory OpenCV/src!!!??
    am using OpenCV2.2

    1. Please refer to It is explained how to configure the OpenCV2.4.5 with Visual Studio 2012. This is the latest version of OpenCV and Visual Studio by now

  3. Hellow, it posible to create DLL that use OpenCV function?

  4. Can we use Microsoft Visual Studio 2010 with Open CV Latest edition _______?

    1. Unhandled exception at 0x000007fefced9e5d in NEW-PROJECT.exe: 0xC06D007E: Module not found.

      I am getting this error while debugging

      I am using Microsoft Visual Studio 2010 Professional OpenCV2.45

    2. please tell me the solution how to handle this .....

      Do i need to install the openCV or just to double click the exe file will be enough ?

    3. Double clicking exe file is not enough. You have to set evironment variables and configure visual studio appropriately. For newer version of OpenCV, please follow this lesson

  5. Hi, nice demonstration about Installing & Configuring OpenCV2.1 with VS 2010 Software.Thanks for your help....


  6. Hi
    my code got built. but there is some error at runtime. It says: Unhandled exception at 0x760fb760 in test.exe: Microsoft C++ exception: cv::Exception at memory location 0x003aeba8..
    Could anyone please help me

  7. Hello guys can someone guide me how to use opencv 2.4.10 with VC 2010

  8. Hi : Thank you for your post regarding visual basic, I try and working fine.. Thanks

  9. If someone need office key can go site to got. My key got here and after i used is works properly. Hope can help you.