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. [Solved] Ignoring old commands - for moc files

[Solved] Ignoring old commands - for moc files

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

    I know the compiler warnings "ignoring old commands" and "overriding commands" very well. They happen when I add a file twice somewhere in my .pro file.

    Now I have a variety of these warning that leaves me wondering what's going on: The same warning, but for moc_*.cpp files.

    The following line of the makefile triggers a "ignoring old commands for target" warning:
    @C:\Qt482_MinGW\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 tscd_scrollviewportcontroller.h -o ..\tmp_tool\win_x86-32_gcc440_d\moc\moc_tscd_scrollviewportcontroller.cpp@

    The makefile is generated by qmake. I have no idea what exactly MinGW doesn't like about this line, and how qmake came to generate it. I've double-checked that the source and header file this moc file belongs to is added only once, that the Q_OBJECT macro is there and only once (though I guess I'd get all kinds of errors if I had a duplicate Q_OBJECT), and I'm running out of ideas here.

    Do you have any?

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

      Hi,
      When something unexplainable happens it is sometimes better to delete the entire build directory (if you used shadow build). Then qmake is run again and new make files are generated. It might be some old stuff lingering around.
      When you place the Q_OBJECT macro the class itself should subclass the QObject or any other class that derives from QObject.

      Greetz, Jeroen

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        Even completely cleaning everything (including deleting all makefiles) doesn't make this issue go away. So I suspect there's something wrong with pro and/or source files after all.

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

          Hi,

          Can you share the content of your pro file ?

          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
          • A Offline
            A Offline
            Asperamanca
            wrote on last edited by
            #5

            Just when pasting the files (the pro-File is split in many pri-Files), I noticed that I did something bad with an intermediate variable that might cause the error. In effect, headers were added twice. But because I added them via an intermediate variable and not literally, like this:

            @HEADERS += $$VARIABLE@

            I couldn't find any mistake by searching for the files the compiler didn't like.

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

              You can use e.g.

              @HEADERS *= $$VARIABLE@

              That should avoid multiple copies of the same value

              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
              • A Offline
                A Offline
                Asperamanca
                wrote on last edited by
                #7

                Useful. I wasn't aware of that operator. Thanks!

                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