[Solved] Ignoring old commands - for moc files



  • 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?



  • 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.



  • 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.


  • Lifetime Qt Champion

    Hi,

    Can you share the content of your pro file ?



  • 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.


  • Lifetime Qt Champion

    You can use e.g.

    @HEADERS *= $$VARIABLE@

    That should avoid multiple copies of the same value



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.