tags:

views:

401

answers:

1

Hi,

I'm using QtCreator on windows using MSVC compiler (the compiler from Visual c++ express edition) and qt 4.5.2 open source.

When I modify a header on the project and press build all, nothing is actually built, only If I modify a .cpp file the modified cpp is compiled.

That causes that every time that I have to change some header file used by several .cpp files I have to rebuild a complete project. There is a way to avoid this behavior?

Thanks in advance

+1  A: 

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

[edit]Nevermind, I tested this out with Qt Creator 1.2.1 from the Qt 4.5.2 SDK on linux, and when I 'touch' a header file, the cpps it depends on are recompiled, whether or not the header is listed in the HEADER list.

In the Makefile qmake generates, my cpp files that include the h file in question have a rule that explicitly lists the h file as a dependancy. Not sure how qmake does that. I'd suggest looking in the makefile qmake generated for you, and seeing what the rule for one of your cpp files looks like.[/edit]

[edit again, getting off topic now]Usually in make-based build system that invoke gcc, you generate dependency information for header files included by cpps by asking gcc to do it for you, with the -M flag. cl.exe (the microsoft C++ compiler) won't produce a .d file no matter how nicely you ask it, so it's somewhat common to use it's /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 anything like that to get dependency information, because qmake is generating a makefile which in turn invokes the compiler, and at that point, the dependency info (at least in the makefile I looked at) is hard-coded.[/edit]

KeyserSoze
Thanks a lot.I will see if I can use visual studio (generating the vcproj from the .pro files) instead. (VS seems to handle the dependencies properly)
Federico