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. Stuck in this Error :::invalid use of incomplete type ‘class Ui::Dialog’ ui(new Ui::Dialog) ^~~~~~
Forum Updated to NodeBB v4.3 + New Features

Stuck in this Error :::invalid use of incomplete type ‘class Ui::Dialog’ ui(new Ui::Dialog) ^~~~~~

Scheduled Pinned Locked Moved Solved General and Desktop
27 Posts 5 Posters 3.8k Views 1 Watching
  • 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.
  • jsulmJ jsulm

    @sankarapandiyan He asked you to post the code...

    sankarapandiyanS Offline
    sankarapandiyanS Offline
    sankarapandiyan
    wrote on last edited by
    #8

    @jsulm sure check it

    1 Reply Last reply
    0
    • J.HilkJ J.Hilk

      @sankarapandiyan nobody will be able to find the error here, show us your header file

      also pls use the code tag to display code:
      428d970c-1ba8-4f15-a496-2180a72170fe-image.png

      sankarapandiyanS Offline
      sankarapandiyanS Offline
      sankarapandiyan
      wrote on last edited by
      #9

      @J-Hilk I have done it

      jsulmJ 1 Reply Last reply
      0
      • sankarapandiyanS sankarapandiyan

        @J-Hilk I have done it

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

        @sankarapandiyan said in Stuck in this Error :::invalid use of incomplete type ‘class Ui::Dialog’ ui(new Ui::Dialog) ^~~~~~:

        I have done it

        Where? I can't see the code from your header files anywhere...

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

        sankarapandiyanS 1 Reply Last reply
        0
        • jsulmJ jsulm

          @sankarapandiyan said in Stuck in this Error :::invalid use of incomplete type ‘class Ui::Dialog’ ui(new Ui::Dialog) ^~~~~~:

          I have done it

          Where? I can't see the code from your header files anywhere...

          sankarapandiyanS Offline
          sankarapandiyanS Offline
          sankarapandiyan
          wrote on last edited by
          #11

          @jsulm i have done

          jsulmJ J.HilkJ 2 Replies Last reply
          0
          • sankarapandiyanS sankarapandiyan

            @jsulm i have done

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

            @sankarapandiyan Sorry, but I can't see it anywhere...

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

            1 Reply Last reply
            0
            • sankarapandiyanS sankarapandiyan

              @jsulm i have done

              J.HilkJ Online
              J.HilkJ Online
              J.Hilk
              Moderators
              wrote on last edited by
              #13

              @sankarapandiyan neither can I


              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
              1
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #14

                Hi
                Please also show

                dialog.h

                and most important

                ui_dialog.h

                sankarapandiyanS 1 Reply Last reply
                0
                • mrjjM mrjj

                  Hi
                  Please also show

                  dialog.h

                  and most important

                  ui_dialog.h

                  sankarapandiyanS Offline
                  sankarapandiyanS Offline
                  sankarapandiyan
                  wrote on last edited by sankarapandiyan
                  #15

                  @mrjj

                  ``

                  i have included #include <ui_dialog.h> in dialog.h 
                  
                  
                  
                  #ifndef DIALOG_H
                  #define DIALOG_H
                  
                  
                  #include <QDialog>
                  #include "mytask.h"
                  #include <ui_dialog.h>
                  namespace Ui {
                  class Dialog;
                  }
                   but the error remains the same   /home/adx-soft1/Desktop/Sankarapandiyan/ProgDial/dialog.cpp:10: error: invalid use of incomplete type ‘class Ui::Dialog’
                       ui(new Ui::Dialog)
                                  ^~~~~~
                  
                  
                  
                  this is my dialog.h 
                  
                  
                  #ifndef DIALOG_H
                  #define DIALOG_H
                  
                  
                  #include <QDialog>
                  #include "mytask.h"
                  #include <ui_dialog.h>
                  
                  
                  
                  namespace Ui {
                  class Dialog;
                  }
                  
                  class Dialog : public QDialog
                  {
                      Q_OBJECT
                  
                  public:
                      explicit Dialog(QWidget *parent = 0);
                      ~Dialog();
                  
                  private slots:
                      void on_modalButton_clicked();
                  
                      void on_modelessButton_clicked();
                  
                  private:
                      Ui::Dialog *ui;
                      MyTask *myTask;
                  };
                  
                  #endif // DIALOG_H
                  
                  
                  jsulmJ 1 Reply Last reply
                  0
                  • sankarapandiyanS sankarapandiyan

                    @mrjj

                    ``

                    i have included #include <ui_dialog.h> in dialog.h 
                    
                    
                    
                    #ifndef DIALOG_H
                    #define DIALOG_H
                    
                    
                    #include <QDialog>
                    #include "mytask.h"
                    #include <ui_dialog.h>
                    namespace Ui {
                    class Dialog;
                    }
                     but the error remains the same   /home/adx-soft1/Desktop/Sankarapandiyan/ProgDial/dialog.cpp:10: error: invalid use of incomplete type ‘class Ui::Dialog’
                         ui(new Ui::Dialog)
                                    ^~~~~~
                    
                    
                    
                    this is my dialog.h 
                    
                    
                    #ifndef DIALOG_H
                    #define DIALOG_H
                    
                    
                    #include <QDialog>
                    #include "mytask.h"
                    #include <ui_dialog.h>
                    
                    
                    
                    namespace Ui {
                    class Dialog;
                    }
                    
                    class Dialog : public QDialog
                    {
                        Q_OBJECT
                    
                    public:
                        explicit Dialog(QWidget *parent = 0);
                        ~Dialog();
                    
                    private slots:
                        void on_modalButton_clicked();
                    
                        void on_modelessButton_clicked();
                    
                    private:
                        Ui::Dialog *ui;
                        MyTask *myTask;
                    };
                    
                    #endif // DIALOG_H
                    
                    
                    jsulmJ Online
                    jsulmJ Online
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #16

                    @sankarapandiyan Can you please simply provide the content of ui_dialog.h? This is what we are asking all the time.

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

                    sankarapandiyanS 1 Reply Last reply
                    1
                    • jsulmJ jsulm

                      @sankarapandiyan Can you please simply provide the content of ui_dialog.h? This is what we are asking all the time.

                      sankarapandiyanS Offline
                      sankarapandiyanS Offline
                      sankarapandiyan
                      wrote on last edited by
                      #17

                      @jsulm [url=https://postimg.cc/tZyZdZ4R][img]https://i.postimg.cc/tZyZdZ4R/Screenshot-from-2019-10-31-13-33-16.png[/img][/url]

                      [url=https://postimg.cc/rd5RtCcY][img]https://i.postimg.cc/rd5RtCcY/Screenshot-from-2019-10-31-13-33-28.png[/img][/url]

                      jsulmJ 1 Reply Last reply
                      0
                      • sankarapandiyanS sankarapandiyan

                        @jsulm [url=https://postimg.cc/tZyZdZ4R][img]https://i.postimg.cc/tZyZdZ4R/Screenshot-from-2019-10-31-13-33-16.png[/img][/url]

                        [url=https://postimg.cc/rd5RtCcY][img]https://i.postimg.cc/rd5RtCcY/Screenshot-from-2019-10-31-13-33-28.png[/img][/url]

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

                        @sankarapandiyan This is not what we asked you to provide!
                        AGAIN: post the content of ui_dialog.h ! It is a normal C++ header file, so symply copy its text and post it here directly...

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

                        sankarapandiyanS 1 Reply Last reply
                        1
                        • jsulmJ jsulm

                          @sankarapandiyan This is not what we asked you to provide!
                          AGAIN: post the content of ui_dialog.h ! It is a normal C++ header file, so symply copy its text and post it here directly...

                          sankarapandiyanS Offline
                          sankarapandiyanS Offline
                          sankarapandiyan
                          wrote on last edited by
                          #19

                          @jsulm ```
                          code_text

                          #define DIALOG_H
                          
                          #include <QDialog>
                          #include<QTimer>
                          #include<QProgressDialog>
                          
                          namespace Ui {
                          class Dialog;
                          }
                          
                          class Dialog : public QDialog
                          {
                              Q_OBJECT
                          
                          public:
                              explicit Dialog(QWidget *parent = nullptr);
                              ~Dialog();
                          public slots:
                              void myfunction();
                              void perform();
                              void cancel();
                          
                          private:
                              Ui::Dialog *ui;
                              int steps;
                              QProgressDialog*pd;
                              QTimer*timer;
                          };
                          
                          #endif // DIALOG_H
                          This is the hedder file of dialog.h
                          jsulmJ 1 Reply Last reply
                          0
                          • sankarapandiyanS sankarapandiyan

                            @jsulm ```
                            code_text

                            #define DIALOG_H
                            
                            #include <QDialog>
                            #include<QTimer>
                            #include<QProgressDialog>
                            
                            namespace Ui {
                            class Dialog;
                            }
                            
                            class Dialog : public QDialog
                            {
                                Q_OBJECT
                            
                            public:
                                explicit Dialog(QWidget *parent = nullptr);
                                ~Dialog();
                            public slots:
                                void myfunction();
                                void perform();
                                void cancel();
                            
                            private:
                                Ui::Dialog *ui;
                                int steps;
                                QProgressDialog*pd;
                                QTimer*timer;
                            };
                            
                            #endif // DIALOG_H
                            This is the hedder file of dialog.h
                            jsulmJ Online
                            jsulmJ Online
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #20

                            @sankarapandiyan Sorry I will stop here as I'm tired to explain that you simply need to copy text from ui_dialog.h and paste it here...

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

                            sankarapandiyanS 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @sankarapandiyan Sorry I will stop here as I'm tired to explain that you simply need to copy text from ui_dialog.h and paste it here...

                              sankarapandiyanS Offline
                              sankarapandiyanS Offline
                              sankarapandiyan
                              wrote on last edited by
                              #21

                              @jsulm i didnt have a content of ui dialog . h , And i am having dialog.h file only is there thats why i have uploaded repeatedly

                              J.HilkJ 1 Reply Last reply
                              0
                              • sankarapandiyanS sankarapandiyan

                                @jsulm i didnt have a content of ui dialog . h , And i am having dialog.h file only is there thats why i have uploaded repeatedly

                                J.HilkJ Online
                                J.HilkJ Online
                                J.Hilk
                                Moderators
                                wrote on last edited by
                                #22

                                @sankarapandiyan
                                it will not be inside QtCreator as it is a automatically created file.

                                But you will find in in your build directory, if you use a normal file explorer, the one that comes with your operating system


                                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.

                                sankarapandiyanS 1 Reply Last reply
                                3
                                • J.HilkJ J.Hilk

                                  @sankarapandiyan
                                  it will not be inside QtCreator as it is a automatically created file.

                                  But you will find in in your build directory, if you use a normal file explorer, the one that comes with your operating system

                                  sankarapandiyanS Offline
                                  sankarapandiyanS Offline
                                  sankarapandiyan
                                  wrote on last edited by
                                  #23
                                  This post is deleted!
                                  mrjjM 1 Reply Last reply
                                  0
                                  • sankarapandiyanS sankarapandiyan

                                    This post is deleted!

                                    mrjjM Offline
                                    mrjjM Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #24

                                    @sankarapandiyan
                                    Nope thats the actual UI file
                                    its
                                    ui_dialog.h
                                    we are after to see if its broken somehow.
                                    Its auto generated file and lives in the build folder
                                    not in project folder.

                                    1 Reply Last reply
                                    2
                                    • sankarapandiyanS Offline
                                      sankarapandiyanS Offline
                                      sankarapandiyan
                                      wrote on last edited by
                                      #25

                                      Thanks a lot ... @mrjj ... Finally ,Here there is a code of ui.dialog.h file , @J-Hilk @jsulm

                                      ** Form generated from reading UI file 'dialog.ui'
                                      **
                                      ** Created by: Qt User Interface Compiler version 5.10.1
                                      **
                                      ** WARNING! All changes made in this file will be lost when recompiling UI file!
                                      ********************************************************************************/
                                      
                                      #ifndef UI_DIALOG_H
                                      #define UI_DIALOG_H
                                      
                                      #include <QtCore/QVariant>
                                      #include <QtWidgets/QAction>
                                      #include <QtWidgets/QApplication>
                                      #include <QtWidgets/QButtonGroup>
                                      #include <QtWidgets/QDialog>
                                      #include <QtWidgets/QGridLayout>
                                      #include <QtWidgets/QHeaderView>
                                      #include <QtWidgets/QPushButton>
                                      #include <QtWidgets/QSpacerItem>
                                      
                                      QT_BEGIN_NAMESPACE
                                      
                                      class Ui_Dialog
                                      {
                                      public:
                                          QGridLayout *gridLayout;
                                          QPushButton *pushButton;
                                          QPushButton *modelessButton;
                                          QPushButton *modalButton;
                                          QSpacerItem *verticalSpacer;
                                      
                                          void setupUi(QDialog *Dialog)
                                          {
                                              if (Dialog->objectName().isEmpty())
                                                  Dialog->setObjectName(QStringLiteral("Dialog"));
                                              Dialog->resize(304, 95);
                                              gridLayout = new QGridLayout(Dialog);
                                              gridLayout->setSpacing(6);
                                              gridLayout->setContentsMargins(11, 11, 11, 11);
                                              gridLayout->setObjectName(QStringLiteral("gridLayout"));
                                              pushButton = new QPushButton(Dialog);
                                              pushButton->setObjectName(QStringLiteral("pushButton"));
                                      
                                              gridLayout->addWidget(pushButton, 2, 1, 1, 1);
                                      
                                              modelessButton = new QPushButton(Dialog);
                                              modelessButton->setObjectName(QStringLiteral("modelessButton"));
                                      
                                              gridLayout->addWidget(modelessButton, 0, 1, 1, 1);
                                      
                                              modalButton = new QPushButton(Dialog);
                                              modalButton->setObjectName(QStringLiteral("modalButton"));
                                      
                                              gridLayout->addWidget(modalButton, 0, 0, 1, 1);
                                      
                                              verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
                                      
                                              gridLayout->addItem(verticalSpacer, 1, 1, 1, 1);
                                      
                                      
                                              retranslateUi(Dialog);
                                              QObject::connect(pushButton, SIGNAL(clicked()), Dialog, SLOT(close()));
                                      
                                              QMetaObject::connectSlotsByName(Dialog);
                                          } // setupUi
                                      
                                          void retranslateUi(QDialog *Dialog)
                                          {
                                              Dialog->setWindowTitle(QApplication::translate("Dialog", "QProgressDialog Launcher", nullptr));
                                              pushButton->setText(QApplication::translate("Dialog", "Cancel", nullptr));
                                              modelessButton->setText(QApplication::translate("Dialog", "Modeless", nullptr));
                                              modalButton->setText(QApplication::translate("Dialog", "Modal", nullptr));
                                          } // retranslateUi
                                      
                                      };
                                      
                                      namespace Ui {
                                          class Dialog: public Ui_Dialog {};
                                      } // namespace Ui
                                      
                                      QT_END_NAMESPACE
                                      
                                      #endif // UI_DIALOG_H
                                      code_text
                                      
                                      jsulmJ 1 Reply Last reply
                                      0
                                      • sankarapandiyanS sankarapandiyan

                                        Thanks a lot ... @mrjj ... Finally ,Here there is a code of ui.dialog.h file , @J-Hilk @jsulm

                                        ** Form generated from reading UI file 'dialog.ui'
                                        **
                                        ** Created by: Qt User Interface Compiler version 5.10.1
                                        **
                                        ** WARNING! All changes made in this file will be lost when recompiling UI file!
                                        ********************************************************************************/
                                        
                                        #ifndef UI_DIALOG_H
                                        #define UI_DIALOG_H
                                        
                                        #include <QtCore/QVariant>
                                        #include <QtWidgets/QAction>
                                        #include <QtWidgets/QApplication>
                                        #include <QtWidgets/QButtonGroup>
                                        #include <QtWidgets/QDialog>
                                        #include <QtWidgets/QGridLayout>
                                        #include <QtWidgets/QHeaderView>
                                        #include <QtWidgets/QPushButton>
                                        #include <QtWidgets/QSpacerItem>
                                        
                                        QT_BEGIN_NAMESPACE
                                        
                                        class Ui_Dialog
                                        {
                                        public:
                                            QGridLayout *gridLayout;
                                            QPushButton *pushButton;
                                            QPushButton *modelessButton;
                                            QPushButton *modalButton;
                                            QSpacerItem *verticalSpacer;
                                        
                                            void setupUi(QDialog *Dialog)
                                            {
                                                if (Dialog->objectName().isEmpty())
                                                    Dialog->setObjectName(QStringLiteral("Dialog"));
                                                Dialog->resize(304, 95);
                                                gridLayout = new QGridLayout(Dialog);
                                                gridLayout->setSpacing(6);
                                                gridLayout->setContentsMargins(11, 11, 11, 11);
                                                gridLayout->setObjectName(QStringLiteral("gridLayout"));
                                                pushButton = new QPushButton(Dialog);
                                                pushButton->setObjectName(QStringLiteral("pushButton"));
                                        
                                                gridLayout->addWidget(pushButton, 2, 1, 1, 1);
                                        
                                                modelessButton = new QPushButton(Dialog);
                                                modelessButton->setObjectName(QStringLiteral("modelessButton"));
                                        
                                                gridLayout->addWidget(modelessButton, 0, 1, 1, 1);
                                        
                                                modalButton = new QPushButton(Dialog);
                                                modalButton->setObjectName(QStringLiteral("modalButton"));
                                        
                                                gridLayout->addWidget(modalButton, 0, 0, 1, 1);
                                        
                                                verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
                                        
                                                gridLayout->addItem(verticalSpacer, 1, 1, 1, 1);
                                        
                                        
                                                retranslateUi(Dialog);
                                                QObject::connect(pushButton, SIGNAL(clicked()), Dialog, SLOT(close()));
                                        
                                                QMetaObject::connectSlotsByName(Dialog);
                                            } // setupUi
                                        
                                            void retranslateUi(QDialog *Dialog)
                                            {
                                                Dialog->setWindowTitle(QApplication::translate("Dialog", "QProgressDialog Launcher", nullptr));
                                                pushButton->setText(QApplication::translate("Dialog", "Cancel", nullptr));
                                                modelessButton->setText(QApplication::translate("Dialog", "Modeless", nullptr));
                                                modalButton->setText(QApplication::translate("Dialog", "Modal", nullptr));
                                            } // retranslateUi
                                        
                                        };
                                        
                                        namespace Ui {
                                            class Dialog: public Ui_Dialog {};
                                        } // namespace Ui
                                        
                                        QT_END_NAMESPACE
                                        
                                        #endif // UI_DIALOG_H
                                        code_text
                                        
                                        jsulmJ Online
                                        jsulmJ Online
                                        jsulm
                                        Lifetime Qt Champion
                                        wrote on last edited by jsulm
                                        #26

                                        @sankarapandiyan OK, the file looks good.
                                        Try to do a complete rebuild:

                                        • Delete the content of the build directory
                                        • Run qmake
                                        • And build

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

                                        1 Reply Last reply
                                        5
                                        • sankarapandiyanS Offline
                                          sankarapandiyanS Offline
                                          sankarapandiyan
                                          wrote on last edited by
                                          #27

                                          Yes it Run Thanks a Lot ..

                                          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