Posted by: sirivy | November 22, 2013

Configurations on MSVC++ 2010 Express for using OpenCV and Qt

Add Include directories

In this example, I add Include directories for Boost, Qt, OpenCV, and VLD.

Right click at project name in Solution Explorer->Configuration Properties->C/C++->General->Additional Include Directories->Edit… . Then, you have to add the following paths as shown in figure below.

Image

Include header files for Qt library
$(QT_DIR)\include
$(QT_DIR)\include\QtCore
$(QT_DIR)\include\QtGui

Include header files for OpenCV
C:\OpenCV-2.4.5\opencv\build\include\opencv2
C:\OpenCV-2.4.5\opencv\build\include\opencv
C:\OpenCV-2.4.5\opencv\build\include

Include header files for C++ Boost
C:\boost_1_54_0

Include header files for Visual Leak Detector
$(VLD_DIR)\include

A QT_DIR variable value is C:\Qt\4.8.5 and VLD_DIR variable value is C:\VisualLeakDetector.
NOTE: Your variable value may be different in your case.

Add library directories

In this example, I add additional library directories for Boost, OpenCV, Qt, and VLD.

Right click at project name in Solution Explorer->Configuration Properties->Linker->General->Additional Library Directories->Edit…

Then, you have to add the following paths as shown in figure below.

AdditionalLibraryConfigurationForOpenCVAndQtAndVLDOnMSVC++

VLD library
$(VLD_DIR)\lib\Win32

Qt library
$(QT_DIR)\lib

Boost C++
C:\boost_1_54_0\stage\lib

OpenCV library
C:\OpenCV-2.4.5\opencv\build\x86\vc10\lib

The last step explains how to add additional dependencies for each library.

Right click at project name in Solution Explorer->Configuration Properties->Linker->Input->Additional Dependencies->Edit…. Then, you have to add .lib files that will be used in your program. In this example, I use the following libraries:

LibNameConfigurationForOpenCVAndQtAndVLDOnMSVC++

VLD library
vld.lib

Qt library
qtmain.lib
QtCore4.lib
QtGui4.lib

OpenCV library
opencv_core245.lib
opencv_highgui245.lib
opencv_flann245.lib
opencv_nonfree245.lib
opencv_features2d245.lib
opencv_objdetect245.lib
opencv_video245.lib
opencv_imgproc245.lib
opencv_ml245.lib

NOTE: This example shows a configuration in release mode. If you would like to configure your project for debug mode, dependencies name may be slightly different.

That’s all. Let’s compile and run the program.🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: