您可以通过以下链接以更有条理的方式解决问题: https://forum.qt.io/topic/95570/videocapture-opencv-error。
有关到目前为止已完成的操作的信息:
我在Ubuntu上安装了opencv,并使用简单的C ++脚本在qt外部对其进行了测试,并且效果很好。
我的编译器是GCC 5.3.1
现在我想在QT小部件应用程序中使用。
这是找到opencv版本时的结果
$(document).ready(function(){
$('tr:first-child>td:first-child>img.size-thumbnail').click()
});
这是.pro文件
pkg-config --modversion opencv
2.4.9.1
这是我的main.cpp文件
T += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = untitled
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain
version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the
APIs deprecated before Qt 6.0.0
CONFIG += c++11
SOURCES += \
main.cpp
HEADERS +=
FORMS +=
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib -lopencv_shape -lopencv_videoio -lopencv_highgui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
我点击了此链接并达到了这一点
https://forum.qt.io/topic/92848/opencv-error-undefined-reference-to-cv-videocapture-videocapture