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. Can no longer build due to no matching function.
QtWS25 Last Chance

Can no longer build due to no matching function.

Scheduled Pinned Locked Moved General and Desktop
build
30 Posts 3 Posters 6.5k 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 Offline
    D Offline
    dejarked
    wrote on last edited by
    #1

    My Qt project has been running fine, and all the code was working. However I realised I had added an incorrect UI file as I needed one with a menu bar. I deleted the original UI file and replaced it. My code however was still somehow calling the original UI file. I cleaned the project and ran QMake on it, as well as retyping the code to call it and still had no luck. The project complied but it didn't use the right file and I had no idea where it was getting the old one from.

    I then took the user files out of the folder to see if that would force it to rebuild and rescan all the files. All that did however was give me an error. I removed the new user files and put the old ones back in and now it just throw up the error:

    • no matching function for call to 'Ui::behindlogin::setupUi(behindlogin* const)'

    and it can't compile. I need to hand the first version of my project in on Friday and I can't even get it to run anymore!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Did you delete the ui file + the corresponding header and source files ? Did you change any name in between ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • D Offline
        D Offline
        dejarked
        wrote on last edited by
        #3

        Thanks for the reply, I deleted the UI file only. I kept the headers from the old file but when I replaced the file I kept all the names the same. I also deleted the call code for the UI file and retyped it.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then, since you're in a hurry, the quick way: move these files out of the source tree, recreate your widget, copy back your custom code if you had any

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          D 1 Reply Last reply
          1
          • SGaistS SGaist

            Then, since you're in a hurry, the quick way: move these files out of the source tree, recreate your widget, copy back your custom code if you had any

            D Offline
            D Offline
            dejarked
            wrote on last edited by dejarked
            #5

            @SGaist Is it fine to copy the GUI as well or should I remake that? As in all my labels and edits etc.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You can copy it, just check that all names are correct

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              D 1 Reply Last reply
              1
              • SGaistS SGaist

                You can copy it, just check that all names are correct

                D Offline
                D Offline
                dejarked
                wrote on last edited by
                #7

                @SGaist So, I just copied over all the code to a completely new project in a new folder and Qt is still throwing me the same error as in the original post.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Don't overwrite the new files with the content of the old one, just cherry-pick the modifications you made e.g. slot added etc.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  D 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    Don't overwrite the new files with the content of the old one, just cherry-pick the modifications you made e.g. slot added etc.

                    D Offline
                    D Offline
                    dejarked
                    wrote on last edited by
                    #9

                    @SGaist Right, I only copied the code from the old slots directly into the ones in the new project made by Qt, still getting the same error.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      So, recreating your widget from scratch in a new project and just copying the slot code gives you the same error ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      D 1 Reply Last reply
                      1
                      • SGaistS SGaist

                        So, recreating your widget from scratch in a new project and just copying the slot code gives you the same error ?

                        D Offline
                        D Offline
                        dejarked
                        wrote on last edited by
                        #11

                        @SGaist Yup, new folder, new project I created all new files in Qt added all my GUI back, followed to slot, then copied the code in and still get the same error

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Did you check that all names were matching ? Ui widget name vs C++ widget name ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          D 1 Reply Last reply
                          1
                          • SGaistS SGaist

                            Did you check that all names were matching ? Ui widget name vs C++ widget name ?

                            D Offline
                            D Offline
                            dejarked
                            wrote on last edited by dejarked
                            #13

                            @SGaist Right, sorry to be causing so many problems, but thank you for the help! Everything is working now, I missed some of the includes, however I can't use .setModal(true); on a new window opening because it's saying the class has no member called setModal

                                        behindlogin behindlogin;
                                        behindlogin.setModal(true);
                                        behindlogin.exec();
                                        connClose();
                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              You're welcome !

                              setModal and exec are methods from QDialog. From what I understood you have a QMainWindow, no ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              D 1 Reply Last reply
                              1
                              • SGaistS SGaist

                                You're welcome !

                                setModal and exec are methods from QDialog. From what I understood you have a QMainWindow, no ?

                                D Offline
                                D Offline
                                dejarked
                                wrote on last edited by
                                #15

                                @SGaist Ahh yes, I've changed from a Dialog to a MainWindow as I wanted the menu bar at the top.

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  So problem solved ? :)

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  D 1 Reply Last reply
                                  1
                                  • SGaistS SGaist

                                    So problem solved ? :)

                                    D Offline
                                    D Offline
                                    dejarked
                                    wrote on last edited by
                                    #17

                                    @SGaist The code actually compiles now! Thank you, the only issue left is I've replaced the code with

                                                behindlogin behindlogin;
                                                behindlogin.show();
                                                connClose();
                                    
                                    
                                    Which causes the window to open and them immediately close after
                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      If you have something like:

                                      {
                                          behindlogin behindlogin;
                                          behindlogin.show();
                                          connClose();
                                      } <- behindlogin is destroyed here
                                      

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      D 1 Reply Last reply
                                      1
                                      • SGaistS SGaist

                                        If you have something like:

                                        {
                                            behindlogin behindlogin;
                                            behindlogin.show();
                                            connClose();
                                        } <- behindlogin is destroyed here
                                        
                                        D Offline
                                        D Offline
                                        dejarked
                                        wrote on last edited by
                                        #19

                                        @SGaist Right, so I've replaced it with

                                                        behindlogin *behindLogin;
                                        

                                        in the header file and then

                                                    behindLogin =new behindlogin(this);
                                                    behindLogin->show();
                                        

                                        in the main cpp file but it's saying that behindlogin does not name a type?

                                        JKSHJ 1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          Is behindlogin a member variable of a class ?

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          D 1 Reply Last reply
                                          1

                                          • Login

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