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. Compiling errors after loading old project
Forum Updated to NodeBB v4.3 + New Features

Compiling errors after loading old project

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 4 Posters 1.0k 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.
  • D Dy3zz

    I reinstalled my virtual machine and tried to load my Qt project. But the problem is that i receive some errors that i didnt have before.
    I let a scressshot of the errors below:

    bb39a13b-7b11-45c8-8baf-74c8ff98cb64-image.png

    This is the .cpp file. The header is the next:

    #ifndef PROJECTVIEW_H
    #define PROJECTVIEW_H
    
    #include <QWidget>
    
    namespace Ui {
    class projectview;
    }
    
    class projectview : public QWidget
    {
        Q_OBJECT
    
    public:
        explicit projectview(QWidget *parent = nullptr);
        ~projectview();
    
    private:
        Ui::projectview *ui;
    };
    

    #endif // PROJECTVIEW_H

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #3

    @Dy3zz said in Compiling errors after loading old project:

    But the problem is that i receive some errors that i didnt have before.

    As @Christian-Ehrlicher says, and you would have had same problem whenever you last saved this file as you show above.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Dy3zz
      wrote on last edited by
      #4

      I added the header but I received the same error:

      3e716815-e272-4e61-bad2-7dd1b4d8c7f3-image.png

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

        Then look into the header and see if the class name is correct.

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

        D 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          Then look into the header and see if the class name is correct.

          D Offline
          D Offline
          Dy3zz
          wrote on last edited by
          #6

          @Christian-Ehrlicher I put the header code in the initial question. It seems to be good for me

          jsulmJ JonBJ 2 Replies Last reply
          0
          • D Dy3zz

            @Christian-Ehrlicher I put the header code in the initial question. It seems to be good for me

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #7

            @Dy3zz Are those real build errors (so, when you build) or just errors from code model in QtCreator?

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

            D 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Dy3zz Are those real build errors (so, when you build) or just errors from code model in QtCreator?

              D Offline
              D Offline
              Dy3zz
              wrote on last edited by
              #8

              @jsulm They shows up when i build the project

              1 Reply Last reply
              0
              • D Dy3zz

                @Christian-Ehrlicher I put the header code in the initial question. It seems to be good for me

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #9

                @Dy3zz
                The question is not what you have in projectview.h but what you have (near the end of) the generated ui_projectview.h file.

                What you are supposed to see there is:

                namespace Ui {
                    class projectView: public Ui_projectView {};
                } // namespace Ui
                
                QT_END_NAMESPACE
                
                #endif // UI_PROJECTVIEW_H
                

                You will get the errors you are seeing if that is not the case.

                If it does have that (or if it does not!), start by deleting all files in your build output directory, re-run qmake, rebuild all from scratch. You may have some "stale" files around.

                D JonBJ 2 Replies Last reply
                1
                • JonBJ JonB

                  @Dy3zz
                  The question is not what you have in projectview.h but what you have (near the end of) the generated ui_projectview.h file.

                  What you are supposed to see there is:

                  namespace Ui {
                      class projectView: public Ui_projectView {};
                  } // namespace Ui
                  
                  QT_END_NAMESPACE
                  
                  #endif // UI_PROJECTVIEW_H
                  

                  You will get the errors you are seeing if that is not the case.

                  If it does have that (or if it does not!), start by deleting all files in your build output directory, re-run qmake, rebuild all from scratch. You may have some "stale" files around.

                  D Offline
                  D Offline
                  Dy3zz
                  wrote on last edited by
                  #10

                  @JonB I don't know where the ui_*.h is located because it is now in the folder with project

                  jsulmJ 1 Reply Last reply
                  0
                  • D Dy3zz

                    @JonB I don't know where the ui_*.h is located because it is now in the folder with project

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    @Dy3zz said in Compiling errors after loading old project:

                    I don't know where the ui_*.h is located

                    In the build folder

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

                    D 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @Dy3zz said in Compiling errors after loading old project:

                      I don't know where the ui_*.h is located

                      In the build folder

                      D Offline
                      D Offline
                      Dy3zz
                      wrote on last edited by
                      #12

                      @jsulm

                      namespace Ui {
                          class project: public Ui_project {};
                      } // namespace Ui
                      
                      QT_END_NAMESPACE
                      
                      #endif // UI_PROJECTVIEW_H
                      

                      This is the end of the ui_viewproject.h file

                      1 Reply Last reply
                      0
                      • JonBJ JonB

                        @Dy3zz
                        The question is not what you have in projectview.h but what you have (near the end of) the generated ui_projectview.h file.

                        What you are supposed to see there is:

                        namespace Ui {
                            class projectView: public Ui_projectView {};
                        } // namespace Ui
                        
                        QT_END_NAMESPACE
                        
                        #endif // UI_PROJECTVIEW_H
                        

                        You will get the errors you are seeing if that is not the case.

                        If it does have that (or if it does not!), start by deleting all files in your build output directory, re-run qmake, rebuild all from scratch. You may have some "stale" files around.

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by JonB
                        #13

                        @Dy3zz
                        You should follow the previously-suggested action:

                        @JonB said in Compiling errors after loading old project:

                        If it does have that (or if it does not!), start by deleting all files in your build output directory, re-run qmake, rebuild all from scratch. You may have some "stale" files around.

                        EDIT
                        Actually, stop. You show

                         class project: public Ui_project {};
                        

                        That is not right, I said it should read projectView. Compare what you have against what I said should be there. I would suggest at some time you renamed the project/projectView class....

                        D 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @Dy3zz
                          You should follow the previously-suggested action:

                          @JonB said in Compiling errors after loading old project:

                          If it does have that (or if it does not!), start by deleting all files in your build output directory, re-run qmake, rebuild all from scratch. You may have some "stale" files around.

                          EDIT
                          Actually, stop. You show

                           class project: public Ui_project {};
                          

                          That is not right, I said it should read projectView. Compare what you have against what I said should be there. I would suggest at some time you renamed the project/projectView class....

                          D Offline
                          D Offline
                          Dy3zz
                          wrote on last edited by
                          #14

                          @JonB said in Compiling errors after loading old project:

                          That is not right, I said it should read projectView. Compare what you have against what I said should be there. I would suggest at some time you renamed the project/projectView class....

                          Yes.. is there anything i can do about it?

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

                            @Dy3zz said in Compiling errors after loading old project:

                            is there anything i can do about it?

                            Either rename your form in the designer or use the correct ui class name in your class.

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

                            D 1 Reply Last reply
                            2
                            • Christian EhrlicherC Christian Ehrlicher

                              @Dy3zz said in Compiling errors after loading old project:

                              is there anything i can do about it?

                              Either rename your form in the designer or use the correct ui class name in your class.

                              D Offline
                              D Offline
                              Dy3zz
                              wrote on last edited by
                              #16

                              @Christian-Ehrlicher it works. Thanks both of you for your time

                              JonBJ 1 Reply Last reply
                              0
                              • D Dy3zz

                                @Christian-Ehrlicher it works. Thanks both of you for your time

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by
                                #17

                                @Dy3zz
                                Both @Christian and @Ehrlicher ? ;-)

                                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