2017-05-03 97 views
0

你好我正在用QT Creator发生编译错误,我想知道是否有人知道为什么会出现这些错误。由于QT Creator出错

main.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" 

我没有确定是什么让这些错误(单词和更多的单词更详细,所以“看起来你的文章需要更多的细节”将消失...它不会消失,所以我会继续打字,直到它选择这样做,但看起来它不会很快。我们去了)。

+0

这不是一个非常有用的问题标题。 – MrEricSir

回答

0

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

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

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

希望有所帮助。