The OpenCV, the Qt Creator and the Windows 7

(For the ones who did not get the title: Il buono, il brutto, il cattivo)
After a few hours of googling and hacking we managed to set up OpenCV 2.3 in Qt Creator under Windows 7.

There are a lot of forum and blog posts out there about this but none of them uses the new OpenCV 2.3.

If you are full of reading linking errors like

undefined reference to `cvLoadImage’

you might have just arrived at the right post in the Internet.

After you have downloaded the binaries for Windows, you get a nice README suggesting this:

If you have problems add build\bin and one of build\{x86|x64}\{vc9\vc10\mingw}\bin to your system path (to use DLLs)

If you want to use Qt Creator with the default (and more standard) MinGW compiler not MSVC then you have just downloaded the wrong version of OpenCV since you will have to compile you own from source. You can get it at the same place you downloaded the the binaries from.

Useful guide here:

Follow this guide to step 20, and dont forget to add the location of dll-s to your PATH after compiling OpenCV.

This post might also be helpful:

Restart your Windows to let the PATH change take effect.

Here’s the code snippet from me .pro file which handles OpenCV.

LIBS += -LC:/OpenCV2.3MinGW/install/bin \
-llibopencv_core230 \

INCLUDEPATH += C:/OpenCV2.3MinGW/install/include \

Explanation: you have to insert the folder of your dll-s after -L and put the name of the desired dll-s after -l .

Happy hacking!


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your 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