-
These instructions were tested with Visual C++ 9.0 (as part of Visual Studio 2008 Professional). These instructions should work without modification with Visual Studio 2005 and 2003. Modifications may be necessary for Visual Studio Express editions. These instructions do not apply to Visual Studio 2010 which uses a different system for setting VC configuration.
Install OpenCV
-
Download the OpenCV 2.1.0 Windows installer - "OpenCV-2.1.0-win32-vs2008.exe".
- Install it to a folder, say "C:/Program Files/OpenCV/OpenCV210/". This article will refer to this path as $openCVDir
- During installation check the option to add it to your Current User PATH
Configure Visual Studio
-
Open VC++ Directories configuration: Tools > Options > Projects and Solutions > VC++ Directories
- Choose "Show directories for: Include files"
- Add "$openCVDir/include/opencv"
- Choose "Show directories for: Library files"
- Add "$openCVDir/lib"
- Choose "Show directories for: Source files"
- Add "$openCVDir/src/cv"
- Add "$openCVDir/src/cvaux"
- Add "$openCVDir/src/cxcore"
- Add "$openCVDir/src/highgui"
Configure your Project
After you've created a project you'll need to add the OpenCV dependencies.
-
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:
- "cv210.lib"
- "cxcore210.lib"
- "highgui210.lib"
- 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.