views:

272

answers:

2

Greetings!

I have a problem with the linking simpliest test program in QTCreator:

CODE:

#include <QtCore/QCoreApplication>

#include <cv.h>

#include<highgui.h>

#include <cxcore.hpp>

using namespace cv;

int _tmain(int argc, _TCHAR* argv[])

{

cv::Mat M(7,7,CV_32FC2,Scalar(1,3));

return 0;

}

.pro file:

QT -= gui

TARGET = testopencv CONFIG += console CONFIG -= app_bundle INCLUDEPATH += C:/OpenCV2_1/include/opencv TEMPLATE = app

LIBS += C:/OpenCV2_1/lib/cxcore210d.lib \ C:/OpenCV2_1/lib/cv210d.lib \ C:/OpenCV2_1/lib/highgui210d.lib\ C:/OpenCV2_1/lib/cvaux210d.lib SOURCES += main.cpp

I've tried to use -L and -l like LIBS+= -LC:/OpenCV2_1/lib -lcxcored

ang .pri file

QMAKE_LIBDIR += C:/OpenCV2_1/lib/Debug

LIBS += -lcxcore210d \ -lcv210d \ -lhighgui210d

The errors are like

debug/main.o:C:\griskin\test\app\testopencv/../../../../OpenCV2_1/include/opencv/cxcore.hpp:97: undefined reference to cv::format(char const*, ...)'

Could anyone help me? Thanks!

In Visual Studio it works but I need it works in QTCreator..

A: 

I have the same problem. did you resolve it?

Andrew
No, I didn't. QT and OpenCV uses different linkers. So it's necessary to rebuild OpenCV with another linker. For the first time I couldn't do it in short time. So I just linked QT and OpenCV as outer libs with another IDE :)
Jane
A: 

Using OpenCV from QTCreator couldn't be any easier. I have a detailed simple way to do it here.

http://www.barbato.us/2010/09/20/using-opencv-within-qtcreator-in-windows/

Good luck and have fun with OpenCV

Enzo