如何将opencv添加到gui QT应用程序?
我在QT中创建了一个新的小部件gui应用程序。 为了使用opencv,我在我的项目中添加了如何将opencv添加到gui QT应用程序?,qt,opencv,Qt,Opencv,我在QT中创建了一个新的小部件gui应用程序。 为了使用opencv,我在我的项目中添加了INCLUDEPATH和LIBS,如下所示: QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = testqt4 TEMPLATE = app SOURCES += main.cpp\ widget.cpp INCLUDEPATH += C:/opencv/build/inclu
INCLUDEPATH
和LIBS
,如下所示:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = testqt4
TEMPLATE = app
SOURCES += main.cpp\
widget.cpp
INCLUDEPATH += C:/opencv/build/include
LIBS += -LC:\opencv\build\x64\vc12\lib
-lopencv_world310d
HEADERS += widget.h
FORMS += widget.ui
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
....
我包括了我想要的opencv标题,如下所示:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = testqt4
TEMPLATE = app
SOURCES += main.cpp\
widget.cpp
INCLUDEPATH += C:/opencv/build/include
LIBS += -LC:\opencv\build\x64\vc12\lib
-lopencv_world310d
HEADERS += widget.h
FORMS += widget.ui
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
....
#ifndef小部件
#定义小部件
#包括
#包括
#包括
....
但当我构建项目时,我遇到了以下错误:
有人能帮我纠正这个错误吗?
谢谢。您正在使用qt creator吗 一旦您更改了
.pro
文件,它将不会更新您的makefile
在“项目”视图中的项目文件夹上单击鼠标右键,然后单击“运行qmake”将对其进行修复。错误是自描述性的。检查你的路径。检查是否存在
highgui/highgui.hpp
。是的,此路径存在,但QT未找到此路径。我不知道为什么会发生这种错误?谢谢。问题解决了,非常感谢。