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. error: ‘QT_INIT_METAOBJECT’ does not name a type; did you mean ‘Q_INIT_RESOURCE’?
Forum Updated to NodeBB v4.3 + New Features

error: ‘QT_INIT_METAOBJECT’ does not name a type; did you mean ‘Q_INIT_RESOURCE’?

Scheduled Pinned Locked Moved Solved General and Desktop
error
10 Posts 3 Posters 3.2k 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.
  • R Offline
    R Offline
    rtvideo
    wrote on 21 Sept 2020, 17:07 last edited by
    #1

    Randomly started getting this error for a reason I do not know, I was editing some functions and all of a sudden this error is popping up. Would anyone know what this means and how to fix it?

    error: ‘QT_INIT_METAOBJECT’ does not name a type; did you mean ‘Q_INIT_RESOURCE’?
    moc_mainwindow.cpp:93:1: error: ‘QT_INIT_METAOBJECT’ does not name a type; did you mean ‘Q_INIT_RESOURCE’?
    QT_INIT_METAOBJECT const QMetaObject MainWindow::staticMetaObject = { {
    ^~~~~~~~~~~~~~~~~~
    Q_INIT_RESOURCE

    1 Reply Last reply
    0
    • C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 22 Sept 2020, 15:54 last edited by
      #10

      I would start with a clean source (make sure there are no generated files) and build dir

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

      1 Reply Last reply
      1
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 21 Sept 2020, 18:37 last edited by
        #2

        Hi,

        Which version of Qt ?
        What code does trigger that ?

        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
        0
        • R Offline
          R Offline
          rtvideo
          wrote on 21 Sept 2020, 18:59 last edited by
          #3

          QT 5.9.5

          This is the function in moc_mainwindow.cpp that is causing the issue

          QT_INIT_METAOBJECT const QMetaObject MainWindow::staticMetaObject = { {
              QMetaObject::SuperData::link<QMainWindow::staticMetaObject>(),
              qt_meta_stringdata_MainWindow.data,
              qt_meta_data_MainWindow,
              qt_static_metacall,
              nullptr,
              nullptr
          } };
          
          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 21 Sept 2020, 19:02 last edited by
            #4

            Can you show your MainWindow header ?

            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
            0
            • R Offline
              R Offline
              rtvideo
              wrote on 21 Sept 2020, 19:09 last edited by
              #5
              This post is deleted!
              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 21 Sept 2020, 19:12 last edited by
                #6

                Nothing obvious comes to mind. Do you have the same issue if you comment all the non Qt related code (includes as well) ?

                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
                0
                • R Offline
                  R Offline
                  rtvideo
                  wrote on 21 Sept 2020, 19:19 last edited by
                  #7

                  Yes unfortunately, I tried upgrading my QT version earlier by downloading another version from the website, could that have messed it up somehow? Should I just try uninstalling all QT versions and reinstalling again?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 21 Sept 2020, 19:43 last edited by
                    #8

                    The content of the moc file can change but that should not concern you directly as they are automatically generated.

                    Any chance that this moc file was not regenerated ?

                    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
                    0
                    • R Offline
                      R Offline
                      rtvideo
                      wrote on 22 Sept 2020, 13:37 last edited by
                      #9

                      It is generated

                      1 Reply Last reply
                      0
                      • C Online
                        C Online
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 22 Sept 2020, 15:54 last edited by
                        #10

                        I would start with a clean source (make sure there are no generated files) and build dir

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

                        1 Reply Last reply
                        1

                        1/10

                        21 Sept 2020, 17:07

                        • Login

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