Header dependencies in qmake using MSVC Express

I am using QtCreator for Windows using MSVC compiler (compiler from Visual C ++ express edition) and open source qt 4.5.2.

When I change the title of the project and click build all, nothing is built, only if I change the .cpp file compiled by the changed cpp.

This leads to the fact that every time I have to change some header file used by multiple .cpp files, I need to rebuild the complete project. Is there a way to avoid this behavior?

Thank you in advance

+2


source to share


1 answer


Are your header files listed in the HEADERS variable in your .pro file? I think enumerating the header files in HEADERS is also required to get the classes inside them MOC'ed.

** [edit] ** Nevermind, I tested this with Qt Creator 1.2.1 from Qt 4.5.2 SDK on linux and when I touch the "header file" the cpps it depends on recompiles no matter whether a title is specified in the HEADER list.



In the Makefile qmake is generated, my cpp files containing the specified h file have a rule that explicitly displays the h file as a dependency. Not sure how qmake does it. I would suggest looking in the qmake makefile generated for you and see what the rule looks like for one of your cpp files. [/ edit]

[edit again, now quit this topic] ** Usually in a make-based build system that is called by gcc, you generate dependency information for the header files included by cpps, ask gcc to do this for you, M. cl.exe (microsoft compiler C ++) won't create a .d file no matter how well you ask it, so it's somewhat accustomed to using the / showincludes option and then parse the output with a script to convert it to a .d file, so make can include it (a lot of people skip this step and just don't have proper dependency checking in make-based builds that use cl.exe, because it's kind of a PITA). However, I don't think qmake does something like this to get dependency information, because qmake generates a makefile, which in turn calls the compiler.and at this point the dependency information (at least in the makefile I was looking at) is coded. [/ edit] **

+1


source







All Articles