本文介绍了体系结构x86_64的未定义符号:cv :: CascadeClassifier :: CascadeClassifier()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OSX的Qt 5.2中使用的是openCV 2.4.6.1.一切都很好,但是当我尝试使用cv :: CascadeClassifier时,发生链接错误,告诉我该符号未为体系结构x86_64定义.有解决的办法吗?谢谢.

I am using openCV 2.4.6.1 in Qt 5.2 on OSX. Everything is fine but when I try to use the cv::CascadeClassifier, a linking error occurs show me that this symbol is not defined for architecture x86_64. Any idea for solving this? Thanks.

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

推荐答案

您需要按如下所示扩展项目文件中的LIBS变量,因为可以在该库中找到cv:CascadeClassifier:

You will need to extend the LIBS variable in your project file as follows because the cv:CascadeClassifier can be found in that library:

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

这篇关于体系结构x86_64的未定义符号:cv :: CascadeClassifier :: CascadeClassifier()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-25 17:10