gpt4 book ai didi

c++ - QT Creator 出错

转载 作者:行者123 更新时间:2023-11-28 05:09:41 26 4
gpt4 key购买 nike

您好,我在使用 QT Creator 时遇到构建错误,我想知道是否有人知道为什么会出现这些错误。谢谢

ma​​in.cpp:

#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsRectItem>
#include <QGraphicsView>


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

QApplication a(argc, argv);

//Create Scene
QGraphicsScene * scene = new QGraphicsScene();

//Creat Item To Put Into Scene
QGraphicsRectItem * rect = new QGraphicsRectItem();
rect->setRect(100, 50, 100, 100);

//Add Item To Scene aka buffer
scene->addItem(rect);

//add a view
QGraphicsView * view = new QGraphicsView(scene);
view->show();

return a.exec();
}

mygame.pro:

#-------------------------------------------------
#
# Project created by QtCreator 2017-05-03T12:14:31
#
#-------------------------------------------------

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = mygame
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as 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


SOURCES += main.cpp

HEADERS +=

编译输出:

Error while building/deploying project mygame (kit: Desktop Qt 5.8.0 MSVC2015_64bit)
When executing step "qmake"

我不确定是什么导致了这些错误(单词单词和更多单词以获取更多详细信息,因此“看起来您的帖子需要更多详细信息”将会消失......它不会消失所以我将继续输入直到它选择这样做,但看起来不会很快。我们开始吧)。

最佳答案

查看“编译输出”选项卡。如果需要,您还可以在命令提示符下运行 qmake。

修复奇怪的 qmake 错误的另一个有用方法是在 Qt Creator 中获取新的项目设置。

关闭 Qt Creator,删除 .pro.user 文件,然后用您的项目重新打开 Qt Creator。这将迫使您使用 Qt 版本调试/发布等重新配置您的项目。

希望对您有所帮助。

关于c++ - QT Creator 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43768895/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com