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. Qt 5.0.2 on 64-bit Windows 7 and moc issue
QtWS25 Last Chance

Qt 5.0.2 on 64-bit Windows 7 and moc issue

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 4.6k 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.
  • W Offline
    W Offline
    Westley
    wrote on last edited by
    #1

    I am a Qt novice and inherited a running Qt app (Qt SDK 4.8) based on Linux and told to port in to 64-bit Windows 7 using MS VS2012. I downloaded Qt 5.0.2 and after making decent progress ran into a obstacle I can't figure out. The moc app generates a .cpp file which contains:

    #if !defined(Q_MOC_OUTPUT_REVISION)
    #error "The header file 'mhnodegui.h' doesn't include <QObject>."
    #elif Q_MOC_OUTPUT_REVISION != 63
    #error "This file was generated using the moc from 4.8.2. It"
    #error "cannot be used with the include files from this version of Qt."
    #error "(The moc has changed too much.)"
    #endif

    The curious thing is that under Qt 5.0.2, Q_MOC_OUTPUT_REVISION is defined as 67 yet the actual moc.exe which is installed with the distribution is 63, the one from Qt 4.8.4. The end result is that I can't compile the moc generated file. I tried changing the definition of Q_MOC_OUTPUT_REVISION to 63 as an experiment to force the compilation to continue with numerous fatal compilation errors. It would appear to me that there is some inconsistency in the 5.0.2 64-bit distribution with respect to moc but, as a total novice, I am sure the problem is something I'm doing but have no idea what.

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi,
      This is maybe more a tools forum thing. Maybe move this post to get better answers?! IYAM what you describe is indeed strange. Did you do a clean install and do you use the latest qt creator to go along with it? It got messed up at my station before causing strange behavior while compiling. It used the qmake of a different qtCreator etc.
      Greetz

      Greetz, Jeroen

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Westley
        wrote on last edited by
        #3

        I downloaded and installed Qt 5.0.2 on a PC that had never had any Qt software of any kind previously installed.

        1 Reply Last reply
        0
        • JeroentjehomeJ Offline
          JeroentjehomeJ Offline
          Jeroentjehome
          wrote on last edited by
          #4

          Hmm, then it might be a compile error on compiling Qt. Enter a bug report I would suggest

          Greetz, Jeroen

          1 Reply Last reply
          0
          • W Offline
            W Offline
            Westley
            wrote on last edited by
            #5

            I downloaded the binary package and so did not compile Qt. Could that be my problem?

            1 Reply Last reply
            0
            • JeroentjehomeJ Offline
              JeroentjehomeJ Offline
              Jeroentjehome
              wrote on last edited by
              #6

              No, that shouldn't be the issue. The SDK's on the top of the download page should be ready without compiling the Qt sources.

              Greetz, Jeroen

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

                Hi,

                Does your codebase contain moc files ? If so, delete them all and rebuild all

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

                  Problem resolved but still confused about something. Lets call the .cpp file generated by moc.exe moc_x.cpp. I didn't realize until today that the file is output in my designated 'debug' directory along with obj files etc. However, there is a copy of moc_x.cpp in the directory which contains the other source files and that file was left over from the previous engineer who had worked with Qt 4.8.4. I was looking at that old file and thinking I was looking at the latest moc output, thus my confusion. The debug/moc_x.cpp was created correctly and referenced the latest version of moc. I was further confused when the latest moc_x.cpp caused the compiler to run out of heap space and I jumped to the conclusion that something was very wrong. Turns out all I had to do was increase the amount of heap space allocated to the VS 2012 compiler (QMAKE_CXXFLAGS += /Zm2000) and the compilation continued to a successful conclusion. Thanks for the help.

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

                    Confusing indeed, It's seems unusual that you need to increase the heap space allocation. You might want to check that on the mailing list (where the developers/maintainers are).

                    Don't forget to remove the moc files from your sources, they really shouldn't be there.

                    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

                    • Login

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