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. Using Qt project code with earlier versions
Forum Updated to NodeBB v4.3 + New Features

Using Qt project code with earlier versions

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 1.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.
  • Z Offline
    Z Offline
    ZINE
    wrote on last edited by ZINE
    #1

    Hi,

    I was using Qt 5.2.1 for creating a Windows C++ .pro project. The application worked well. Then, i download The last Qt version 5.12.3 and i create a Qt Widgets application. I used my Qt 5.2.1 version code (.cpp file code, .h Header code, and .ui file code). However, i get a build errors as if the 5.12.3 version do not recognize the classes used in the code, and which was used correctly in the Qt 5.2.1 version. Is there a way to fix this ?

    aha_1980A 1 Reply Last reply
    0
    • Z ZINE

      Hi,

      I was using Qt 5.2.1 for creating a Windows C++ .pro project. The application worked well. Then, i download The last Qt version 5.12.3 and i create a Qt Widgets application. I used my Qt 5.2.1 version code (.cpp file code, .h Header code, and .ui file code). However, i get a build errors as if the 5.12.3 version do not recognize the classes used in the code, and which was used correctly in the Qt 5.2.1 version. Is there a way to fix this ?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @ZINE

      Is there a way to fix this ?

      The best way is by giving us your exact error messages, because otherwise we'd need a cristal ball.

      Regards

      Qt has to stay free or it will die.

      J.HilkJ 1 Reply Last reply
      2
      • aha_1980A aha_1980

        @ZINE

        Is there a way to fix this ?

        The best way is by giving us your exact error messages, because otherwise we'd need a cristal ball.

        Regards

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

        @aha_1980 Well my crystal ball tells me the op did not link the (presumably) copied header, source and ui files inside the new *pro file. But just made an include "xyzzy.h"

        Prompting the error, as qmake failed to create the moc files for those classes.


        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
        • Z Offline
          Z Offline
          ZINE
          wrote on last edited by ZINE
          #4

          @aha_1980 @J-Hilk Here is my .pro file in Qt 5.12.3 version :

          0_1556615852625_308a293b-94fa-46f8-83e3-0777a589048a-image.png
          0_1556615896391_c03b6a14-f0a6-4043-8863-2428d0510927-image.png

          Here is an example of errors from mainwindow.cpp :

          0_1556615655883_888fa518-ec73-4d02-a286-e06c9561f583-image.png

          And here is the include in the same mainwindow.cpp file :

          0_1556615730824_e30fb14c-e4f7-4763-9986-edb619f48b55-image.png

          The code work well in Qt 5.2.1 version. Can you give me some advice about how to change .pro file to fix this problem ?

          J.HilkJ aha_1980A 2 Replies Last reply
          0
          • A Offline
            A Offline
            arsinte_andrei
            wrote on last edited by
            #5

            you miss some header file - langue_button is not defined you should have something like

            private:
            QPushButton *langue_button;
            
            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              ZINE
              wrote on last edited by
              #6

              @arsinte_andrei langue_button is already declared in mainwindow.h and ui_mainwindow.h ! these files are already included.

              1 Reply Last reply
              0
              • Z ZINE

                @aha_1980 @J-Hilk Here is my .pro file in Qt 5.12.3 version :

                0_1556615852625_308a293b-94fa-46f8-83e3-0777a589048a-image.png
                0_1556615896391_c03b6a14-f0a6-4043-8863-2428d0510927-image.png

                Here is an example of errors from mainwindow.cpp :

                0_1556615655883_888fa518-ec73-4d02-a286-e06c9561f583-image.png

                And here is the include in the same mainwindow.cpp file :

                0_1556615730824_e30fb14c-e4f7-4763-9986-edb619f48b55-image.png

                The code work well in Qt 5.2.1 version. Can you give me some advice about how to change .pro file to fix this problem ?

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

                @ZINE

                Well my guess was not correct ;-)

                Did you forget to run qmake after adding those files to your pro file ?


                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
                • Z Offline
                  Z Offline
                  ZINE
                  wrote on last edited by
                  #8

                  @J-Hilk No. I copied the files to the project directory, i add the files to my pro file then i build the project. How i can run the qmake ?

                  J.HilkJ 1 Reply Last reply
                  0
                  • Z ZINE

                    @J-Hilk No. I copied the files to the project directory, i add the files to my pro file then i build the project. How i can run the qmake ?

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

                    @ZINE
                    0_1556624687569_11ea05f9-69fc-46a5-928a-776159ef0751-image.png


                    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
                    3
                    • Z ZINE

                      @aha_1980 @J-Hilk Here is my .pro file in Qt 5.12.3 version :

                      0_1556615852625_308a293b-94fa-46f8-83e3-0777a589048a-image.png
                      0_1556615896391_c03b6a14-f0a6-4043-8863-2428d0510927-image.png

                      Here is an example of errors from mainwindow.cpp :

                      0_1556615655883_888fa518-ec73-4d02-a286-e06c9561f583-image.png

                      And here is the include in the same mainwindow.cpp file :

                      0_1556615730824_e30fb14c-e4f7-4763-9986-edb619f48b55-image.png

                      The code work well in Qt 5.2.1 version. Can you give me some advice about how to change .pro file to fix this problem ?

                      aha_1980A Offline
                      aha_1980A Offline
                      aha_1980
                      Lifetime Qt Champion
                      wrote on last edited by aha_1980
                      #10

                      @ZINE

                      Please post code as text, not as screenshot! It's impossible for me to copy relavant lines and comment on them.

                      That said, your .pro file looks overall sane, just the constructs at the beginning are redundand.

                      QT = core gui widgets should be enough. Everything else until TARGET can be removed.

                      The code errors come from the Clang Code Model, probably because it cannot find a header or has problems parsing a header. To investigate this problem, you should:

                      1. Actually try to compile the project (Ctrl+B)
                      2. Test if a new generated, simple project (form the wizards) works well.

                      If you don't want to invest much time in this, Clang Code Model can be disabled in Help > About Plugins > Clang Code Model.

                      Regards

                      Qt has to stay free or it will die.

                      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