2017-08-09 273 views
1

我已經安裝了Qt Creator和msvc2017_64二進制文件。我還安裝了VS2017的Qt插件。我可以創建一個沒有任何問題的QtGuiApplication,但是當我嘗試編譯它時,會出現很多錯誤。我在pastebin上列出了它們here,因爲我無法將這些字符添加到Stackoverflow。我很抱歉。Qt for Visual Studio 2017的C++編譯問題

我是否需要任何必要的軟件包?我安裝了C++ for VS2017 ofc。我還在Qt VS Tools菜單中加入了QtPath。

由於項目創建和編譯失敗,我沒有編輯文件,因爲錯誤。


編輯:這個問題就解決了here。但是,並非只有錯誤形成引擎收錄存在,也是在QtGuiApplication.h


QtGuiApplication.h的一個如下:(標記爲錯誤的意見)

#pragma once 

#include <QtWidgets/QMainWindow> 
#include "ui_QtGuiApplication1.h" //This could not be found 

class QtGuiApplication1 : public QMainWindow 
{ 
    Q_OBJECT 

public: 
    QtGuiApplication1(QWidget *parent = Q_NULLPTR); 

private: 
    Ui::QtGuiApplication1Class ui; //Ui namespace does not exist 
}; 

QtApplication.cpp :

#include "stdafx.h" 
#include "QtGuiApplication1.h" 

QtGuiApplication1::QtGuiApplication1(QWidget *parent) 
    : QMainWindow(parent) 
{ 
    ui.setupUi(this); 
} 

main.cpp:

#include "stdafx.h" 
#include "QtGuiApplication1.h" 
#include <QtWidgets/QApplication> 

int main(int argc, char *argv[]) 
{ 
    QApplication a(argc, argv); 
    QtGuiApplication1 w; 
    w.show(); 
    return a.exec(); 
} 
+0

可能的[Visual Studio 2017標準頭文件錯誤]錯誤重複(https://stackoverflow.com/questions/42777424/visual-studio-2017-errors-on-standard-headers) – drescherjm

+1

下次請將錯誤從Visual Studio的「輸出」選項卡而不是「錯誤」選項卡。 「輸出」選項卡以更好的格式發佈爲文本。 – drescherjm

+0

@drescherjm是的,這解決了我的大部分Erros,謝謝。但QtGuiApplication.h中的錯誤仍然存​​在。 – StckoflwUsr

回答

1

我自己解決了這個問題!

Qt外接程序使用Windowns 8.1 SDK創建項目,您需要將其重定向到Win 10 SDK以獲取來自QtGuiApplication.h的編譯錯誤。即使安裝了8.1 SDK。看起來像一個錯誤。