【问题标题】:C1083: Cannot open include file: 'QPushButton' with cmake and qtC1083:无法使用 cmake 和 qt 打开包含文件:“QPushButton”
【发布时间】:2018-06-08 17:52:59
【问题描述】:

我的cmake:

set(QT_VERSION_REQ "5.11.0")
find_package(Qt5 COMPONENTS Core Quick Widgets REQUIRED)

我的包括:

#include <QGuiApplication> //ok
#include <QQmlApplicationEngine> //ok
#include <QPushButton> // <<==  fails!!

我的 cmake 中缺少什么?

【问题讨论】:

  • 您能否编辑您的问题以包含错误消息和失败命令的准确文本。

标签: qt visual-c++ cmake


【解决方案1】:

解决方法是通过这种方式添加 QT Widget:

find_package(Qt5 COMPONENTS Core Quick REQUIRED)  
find_package(Qt5Widgets)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick Qt5::Widgets ${OpenCV_LIBS})

【讨论】:

    猜你喜欢
    • 2022-12-11
    • 1970-01-01
    • 2014-12-07
    • 2017-01-28
    • 2011-02-07
    • 2016-04-15
    • 2010-09-17
    相关资源
    最近更新 更多