2

I have installed Qt Creator with the msvc2017_64 binary. I also installed the Qt add-in for VS2017. I can create a QtGuiApplication without any problems, but when i try to compile it, many errors appear. I listed them here, on pastebin, because I cannot add this many characters to Stackoverflow. I'm sorry for that.

Do I need any essential packages for this? I installed C++ for VS2017 ofc. I also included the QtPath in the Qt VS Tools menu.

I did not edit the files since project creation and compiling fails due to errors.


EDIT: This problem is solved here. But not only the Errors form Pastebin exist, also the one following in the QtGuiApplication.h


QtGuiApplication.h: (Errors marked as comments)

#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();
}
Donald Duck
  • 8,409
  • 22
  • 75
  • 99
  • Possible duplicate of [Visual Studio 2017 errors on standard headers](https://stackoverflow.com/questions/42777424/visual-studio-2017-errors-on-standard-headers) – drescherjm Aug 09 '17 at 17:23
  • 1
    Next time please post the errors from the Output tab of Visual Studio instead of the errors tab. The Output Tab is in a better format for posting as text. – drescherjm Aug 09 '17 at 17:25
  • @drescherjm Yeah, that solved most of my Erros, thanks. But the errors in the QtGuiApplication.h still exist. – StckoflwUsr Aug 09 '17 at 17:32
  • ***#include "ui_QtGuiApplication1.h" //This could not be found*** likely means that uic was not run on your .ui file. The addon is supposed to do that for you. I do use Visual Studio but don't use the addon so I am not sure how to fix that. I use CMake instead. – drescherjm Aug 09 '17 at 17:34

2 Answers2

2

I solved this problem myself!

The Qt add-in creates the Project with the Windowns 8.1 SDK, you need to retarget it to the Win 10 SDK to get the compile Errors from the QtGuiApplication.h away. Even if the 8.1 SDK is installed. Seems like a bug.

0

The solution was quite simple to me, just unload and then reload the solution from Solution Explorer! This will clear all c++ compiler errors! Don't know why ...

Khalil Youssefi
  • 385
  • 6
  • 10