PDA

View Full Version : Problem with Integrating QT Creator and OPENCV



RG84
13th July 2012, 13:52
Hello everyone,
I will apologize in advance for asking this because I know this is a topic that's been discussed , but unfortunately for me none of the many topics I've searched have helped me.

I am trying to write a simple program using opencv in QT CREATOR(few lines of code involving basic opencv functions), but am receiving errors as such:
" error: undefined reference to `cvNamedWindow' "
here is the pro file


HEADERS = patientdata.h \
recordingSoftwareGui.h \
functions.h \
filemanagement.h \
patienttrial.h \
addtrialdialog.h \
asciiTable.h \
Rectangle.h \
Point.h
SOURCES = main.cpp \
patientdata.cpp \
functions.cpp \
recordingSoftwareGui.cpp \
filemanagement.cpp \
patienttrial.cpp \
addtrialdialog.cpp
FORMS = recordingSoftwareGui.ui \
addtrialdialog.ui

INCLUDEPATH+= D:\OPENCV240MIN2\install\include\
D:\OPENCV240MIN2\install\include\opencv \
D:\OPENCV240MIN2\install\include\opencv2 \
D:\OPENCV240MIN2\install\include\opencv2\calib3d \
D:\OPENCV240MIN2\install\include\opencv2\contrib \
D:\OPENCV240MIN2\install\include\opencv2\core \
D:\OPENCV240MIN2\install\include\opencv2\features2 d \
D:\OPENCV240MIN2\install\include\opencv2\flann \
D:\OPENCV240MIN2\install\include\opencv2\gpu \
D:\OPENCV240MIN2\install\include\opencv2\highgui \
D:\OPENCV240MIN2\install\include\opencv2\legacy \
D:\OPENCV240MIN2\install\include\opencv2\ml \
D:\OPENCV240MIN2\install\include\opencv2\nonfree \
D:\OPENCV240MIN2\install\include\opencv2\objdetect \
D:\OPENCV240MIN2\install\include\opencv2\photo \
D:\OPENCV240MIN2\install\include\opencv2\stitching \
D:\OPENCV240MIN2\install\include\opencv2\ts \
D:\OPENCV240MIN2\install\include\opencv2\video \
D:\OPENCV240MIN2\install\include\opencv2\videostab

LIBS+=-L"D:\OPENCV240MIN2\install\lib"



I have tried 5-6 different versions of opencv- some of which compiled with mingw , some of which precompiled with MSVC.
I have made sure to compile opencv with the same gcc and g++ that QT uses.
Yet I still am not making any progress ; I am using QT version 4.8.0 if that makes any difference.
Any help would be appreciated , thank you.

ChrisW67
27th July 2012, 03:12
Use / in preference to \ in file paths in the PRO file (actually anywhere in Qt).

Line 20 should have a space before the continuation \ or it will run together with line 21

Line 40 should list the libraries that you wish the program to link against (-l options). You currently list none, only a search location (-L option)