StckoflwUsr
StckoflwUsr

Reputation: 41

C++ compile problems with Qt for Visual Studio 2017

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();
}

Upvotes: 2

Views: 1864

Answers (2)

Khalil Youssefi
Khalil Youssefi

Reputation: 414

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

Upvotes: 0

StckoflwUsr
StckoflwUsr

Reputation: 41

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.

Upvotes: 2

Related Questions