我在OSX上的Qt 5.2中使用openCV 2.4.6.1。一切都很好但是当我尝试使用cv :: CascadeClassifier时,会发生链接错误,告诉我这个符号没有为架构x86_64定义。有什么想法解决这个问题?感谢。
TEMPLATE = app
TARGET = camera
QT += multimedia multimediawidgets
INCLUDEPATH += /usr/local/Cellar/opencv/2.4.6.1/include \
LIBS += -L/usr/local/Cellar/opencv/2.4.6.1/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_features2d \
-lopencv_highgui
HEADERS = \
camera.h \
imagesettings.h \
videosettings.h \
SOURCES = \
main.cpp \
camera.cpp \
imagesettings.cpp \
videosettings.cpp \
FORMS += \
camera.ui \
videosettings.ui \
imagesettings.ui
target.path = $$[QT_INSTALL_EXAMPLES]/multimediawidgets/camera
INSTALLS += target
QT+=widgets
答案 0 :(得分:1)
您需要在项目文件中扩展LIBS
变量,如下所示:因为cv:CascadeClassifier
可以在该库中找到:
LIBS += -L/usr/local/Cellar/opencv/2.4.6.1/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_features2d \
-lopencv_highgui \
-lopencv_objdetect # This is the addition
答案 1 :(得分:0)
这为我解决了这个问题:
自:
http://answers.opencv.org/question/4655/link-error-for-only-cascadeclassifier-under-243/