2017-05-03 166 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版本調試/發佈等來重新配置你的項目。

希望有所幫助。