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. "undefined reference" in moc_mainwindow after deleting GUI element
Forum Updated to NodeBB v4.3 + New Features

"undefined reference" in moc_mainwindow after deleting GUI element

Scheduled Pinned Locked Moved General and Desktop
8 Posts 8 Posters 4.3k Views 2 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.
  • A Offline
    A Offline
    AleSantaCruz
    wrote on 14 Oct 2013, 16:38 last edited by
    #1

    Hi everyone,

    I'm quite new in QT, but im hanging in there.

    Im working on a project, and everything was OK, until i deleted spin boxes (and related functions) from my main window, because a decided to use some other tools instead.

    The problem is that now the App just doesn't compile, i have 3 errors referring to this 3 spinboxes on the moc_mainwindow file. No matter how much times i clean the project, delete the files, or even edit manually the moc file, i cant get rid of this.

    Last time i had this problem, i created a new project, and copied manually the files and GUI from the old project to the new one. This time i want to fix it the right way, it cant be possible that every time i delete an element from my GUI i have this problem, what should i do next time?

    I already googled a lot with no further success, please give me a hand on this, it's very basic, so i hope someone had successfully over passed this situation.

    Thanks!

    1 Reply Last reply
    1
    • N Offline
      N Offline
      NicuPopescu
      wrote on 14 Oct 2013, 18:55 last edited by
      #2

      Hi,

      moc file is a code generated file so it doesn't make any sense to edit it by hand, next time at compilation time will be generated in the same way

      deleting widgets from any ui form in designer for sure will be reflected in the ui header file generated ... I think the undefined references come from elsewhere

      I don't know how big is your project but try something simple on a small project and figure out if the issue persists?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        M Tims
        wrote on 18 Oct 2013, 04:59 last edited by
        #3

        Try running qmake again on the project before rebuilding.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jeroentjehome
          wrote on 18 Oct 2013, 06:03 last edited by
          #4

          When Gui elements are changed in designer and you encounter this error it is usually a QMake rebuild! When it has to do with automatic slot creation a manual delete of the "switch/case" value might be needed!
          Greetz

          Greetz, Jeroen

          1 Reply Last reply
          0
          • R Offline
            R Offline
            RahulM44
            wrote on 22 Oct 2020, 14:44 last edited by
            #5

            I had problem in mainwindow.h . The slot functions were declared there, which after removing solved the problem.

            C 1 Reply Last reply 22 Oct 2020, 15:49
            1
            • R RahulM44
              22 Oct 2020, 14:44

              I had problem in mainwindow.h . The slot functions were declared there, which after removing solved the problem.

              C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 22 Oct 2020, 15:49 last edited by
              #6

              @RahulM44 And you really think this is important on a topic which is more than 7 years old?

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

              P 1 Reply Last reply 23 Oct 2020, 02:05
              0
              • C Christian Ehrlicher
                22 Oct 2020, 15:49

                @RahulM44 And you really think this is important on a topic which is more than 7 years old?

                P Offline
                P Offline
                Pl45m4
                wrote on 23 Oct 2020, 02:05 last edited by
                #7

                @Christian-Ehrlicher

                Maybe OP is still looking for a solution 😂 You never know 😉


                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                ~E. W. Dijkstra

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  Tyrell Wellick09
                  wrote on 17 Jun 2023, 00:46 last edited by
                  #8

                  Hello, I know this is a very old topic but if this helps anyone.
                  This error occurs because the moc file is auto-generated, so if you don't remove all the declarations from the slots, it doesn't matter how many times you remove them from the moc file. you have to look for the names of the deleted objects in the headers or cpp files of your project, delete them and compile again.

                  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