Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. incomplete type is not allowed
Forum Updated to NodeBB v4.3 + New Features

incomplete type is not allowed

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 4 Posters 3.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aminmlp
    wrote on last edited by
    #1

    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_OBJECT

    private:
    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?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Aminmlp
        wrote on last edited by
        #3

        I know this my friend. this is a example of Qt website

        jsulmJ 1 Reply Last reply
        0
        • A Aminmlp

          I know this my friend. this is a example of Qt website

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Aminmlp said in incomplete type is not allowed:

          Qt website

          Which one?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Aminmlp
            wrote on last edited by
            #5

            this one.
            https://doc.qt.io/qt-5/qtnetwork-secureudpclient-example.html

            jsulmJ 1 Reply Last reply
            0
            • A Aminmlp

              this one.
              https://doc.qt.io/qt-5/qtnetwork-secureudpclient-example.html

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Aminmlp Compiles for me.
              I guess you see it not when building instead it comes from code model?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply
              0
              • A Offline
                A Offline
                Aminmlp
                wrote on last edited by
                #7

                what do you mean?

                jsulmJ 1 Reply Last reply
                0
                • A Aminmlp

                  what do you mean?

                  jsulmJ Online
                  jsulmJ Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Aminmlp When do you see this error?
                  Is it when you build the project?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Aminmlp Compiles for me.
                    I guess you see it not when building instead it comes from code model?

                    A Offline
                    A Offline
                    Aminmlp
                    wrote on last edited by
                    #9

                    @jsulm yes you are right.

                    J.HilkJ 1 Reply Last reply
                    0
                    • A Aminmlp

                      @jsulm yes you are right.

                      J.HilkJ Offline
                      J.HilkJ Offline
                      J.Hilk
                      Moderators
                      wrote on last edited by
                      #10

                      @Aminmlp how do you build it ?


                      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                      Q: What's that?
                      A: It's blue light.
                      Q: What does it do?
                      A: It turns blue.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved