找回密码
 立即注册
收起左侧

include<QState>时出现问题,求助

0
回复
14735
查看
[复制链接]

尚未签到

来源: 2021-5-16 14:47:18 显示全部楼层 |阅读模式
1Qter豆
$main.cpp:5: error: C1083: 无法打开包括文件: “QState”: No such file or directory

include<QStateMachine>时候也是这个问题,目前Qt版本应该是6
.pro文件中是这样:
QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    main.cpp \
    mainwindow.cpp

HEADERS += \
    mainwindow.h

FORMS += \
    mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target


main.cpp是这样:
#include "mainwindow.h"

#include <QApplication>
#include <QPushButton>
#include <QState>
#include <QStateMachine>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QPushButton button("State Machine");
    QStateMachine machine;
    QState* s1 = new QState(&machine);

    return a.exec();
}

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了