我正在使用Ubuntu 16.04LTS和Qt Creator。编译时,出现以下错误。
警告:找不到:opencv2 / opencv.hpp
我重新安装了OpenCV和Qt两次,但问题仍然存在。
请在下面找到* .pro文件
#-------------------------------------------------
#
# Project created by QtCreator 2018-07-13T12:41:30
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Hello_OpenCV_Qt
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
win32: {
include("c:/dev/opencv/opencv.pri")
}
unix: !macx {
CONFIG += link_pkgconfig
PKGCONFIG += opencv
}
unix: macx {
INCLUDEPATH += "/usr/local/include"
LIBS += -L"/usr/local/lib" \
-lopencv_world
}
# 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
SOURCES += \
main.cpp \
mainwindow.cpp \
HEADERS += \
mainwindow.h \
opencv2/opencv.hpp
FORMS += \
mainwindow.ui
谢谢。