incomplete type is not allowed
-
this my .h file:
#pragma once
#include <QtCore>
#include <QtWidgets>using namespace Qt;
#include "ui_addressdialog.h"
namespace Ui
{
class AddressDialog
}class AddressDialog : public QDialog
{
Q_OBJECTprivate:
Ui::AddressDialog *ui = nullptr;
public:
explicit AddressDialog(QWidget *parent = nullptr);
~AddressDialog();
QString remoteName() const;
quint16 remotePort() const;and this is .cpp file:
#include <QtCore>
#include <QtWidgets>
#include <QtNetwork>
#include <limits>#include "stdafx.h"
#include "addressdialog.h"
#include "ui_addressdialog.h"AddressDialog::AddressDialog(QWidget *parent)
: QDialog(parent), ui(new Ui:: AddressDialog) //error
{
ui->setupUi(this); //error
setupHostSelector();
setupPortSelector();
}AddressDialog::~AddressDialog()
{
delete ui;
}I use Qt in VS 2017. in ui(new Ui:: AddressDialog), I have the "incomplete type is not allowed". why?
-
C++ basics - you have to (forward) declare a type before you can use it. So either include the generated ui file in your header or forward declare it there.
-
-