PDA

View Full Version : Problem with QtCreator + OpenCV



rastru
28th July 2010, 22:17
Hello
This is my first post, first of all say that I have read many post on this forum and others but have not found the solution to my problem:
http://labs.trolltech.com/forums/topic/1884
http://www.qtcentre.org/threads/32178-Using-OpenCV-with-QT-creator
...

My problem is that when compiling QtCreator I get the following error:


Running steps for project build Qt ...
Configuration Unchanged, skipping qmake step.
Starting "/ usr / bin / make-w
make: Entering directory `/ Users / Laura / Desktop / VC / Qt-build-desktop '
/ Usr / bin / qmake-spec / macx usr/local/Qt4.6/mkspecs/macx-g + +-Makefile-o .. / Qt / Qt.pro
make: Leaving directory `/ Users / Laura / Desktop / VC / Qt-build-desktop '
make: Entering directory `/ Users / Laura / Desktop / VC / Qt-build-desktop '
g + +-headerpad_max_install_names-arch i386-o Qt.app / Contents / MacOS / Qt main.o mainwindow.o moc_mainwindow.o -F/Library/Frameworks -L/Library/Frameworks -L/opt/local/bin /-cxcore210 - cvaux210-cv210-highgui210-framework QtCore-framework QtGui
Undefined symbols:
"Cv:: fastFree (void *)", referenced from:
cv:: Mat:: release () in main.o
ld: symbol (s) not found
collect2: ld returned 1 exit status
make: *** [Qt.app / Contents / MacOS / Qt] Error 1
make: Leaving directory `/ Users / Laura / Desktop / VC / Qt-build-desktop '
The process "/ usr / bin / make" exited with code% 2.
Error while building Qt project (target: Desktop)
When executing build step 'Make'

My OS is: Mac OS X 10.6.4

In .pro QtCreator towards I added the following lines:

INCLUDEPATH + = "/ usr / local / include / opencv"
LIBS + =-L '/ opt / Local / bin / "-cxcore210-cvaux210-cv210-highgui210

My PATH is:

echo $ PATH
/ Usr / local / include / opencv: / opt / local / bin: / opt / local / sbin: / usr / bin: / bin: / usr / sbin: / sbin: / usr / local / bin: / usr / texbin : / usr/X11/bin

The program is an example, with an added line:

# Include <QtGui/QApplication>
# Include "mainwindow.h"
# Include "cv.h"
# Include "cxcore.h"
# Include "highgui.h"
using namespace cv;
int main (int argc, char * argv [])
(
QApplication a (argc, argv);
MainWindow w;
w.show ();
Mat matrix/ / line that fails
return a.exec ();
)

Any idea how to fix the error?

tbscope
29th July 2010, 11:22
Are you really sure that this is correct?


-L/opt/local/bin /-cxcore210 - cvaux210-cv210-highgui210-framework

Because I don't think so.

I guess it should be more like

-lcxcore -lcv -lcvaux -lhighgui -lml
Maybe with a version number like 210.

rastru
29th July 2010, 16:03
No, I am not sure, I tested 10 000 things, but if I put

LIBS += -lcv
I get the following error:

Running build steps for project Qt...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w
make: Entering directory `/Users/Laura/Desktop/VC/Qt-build-desktop'
g++ -headerpad_max_install_names -arch i386 -o Qt.app/Contents/MacOS/Qt main.o mainwindow.o moc_mainwindow.o -F/Library/Frameworks -L/Library/Frameworks -lcv -framework QtGui -framework QtCore
ld: warning: in /usr/lib/libcv.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
"cv::fastFree(void*)", referenced from:
cv::Mat::release() in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [Qt.app/Contents/MacOS/Qt] Error 1
make: Leaving directory `/Users/Laura/Desktop/VC/Qt-build-desktop'
The process "/usr/bin/make" exited with code %2.
Error while building project Qt (target: Desktop)
When executing build step 'Make'
and -lcv210 not find it (I have installed opencv2.1)

Rida
24th September 2010, 21:34
Hello,
Hello:
I faced the same problem while trying to use OpenCv library with Qt!
I am using:
1) OpenCv2.0
2) Qt Creator 2.01 Based on Qt 4.7.0 (32 bit)
3) Windows Xp

So I solved the problem by adding the following tags in the .pro file:

LIBS += -L C:\OpenCV2.0\bin -lcxcore200 -lcv200 -lcvaux200 -lhighgui200 -lml200 -lcxts200
INCLUDEPATH += C:/OpenCV2.0/include/opencv

Hope this will work :):)