You should not run qmake -project
multiple times. The -project
option is meant to provide you a template project file for you to edit. An equivalent of what you are doing in an IDE would be creating a "New Project" every time you want to build. After you have the initial project, you should edit it manually, add files when you have new files, etc. If some header file changes, the generated Makefile will notice it and call moc on it to update the moc_*.cpp file automatically. So:
- Run
qmake -project
when you start working on a project.
- Run
qmake
when you want to generate Makefiles.
- Run
make
when you want to build the project.