Important: Please read the Qt Code of Conduct -

[solved] how to recompile all headers in VS?

  • Is there any way to recompile all headers to invoke moc in Visual Studio? I deleted all moc files and need to generate them again, but Visual Studio "rebuild all" command compiles only source files. Currently the only known solution for me is to open each header manually and recompile, which is boring.

  • Solved:

    1. Replace Q_OBJECT in all files to something like QOBJECT_REPLACEMENT, save files, then replace again - this will re-add moc files
    2. now have many open files, repeatedly call temporary macro to compile all:
      @Sub makeMoc()
      End Sub@
    3. in other configuration (release), build called moc properly, so no changes required.

Log in to reply