Details
-
Bug
-
Resolution: Duplicate
-
P4: Low
-
None
-
Qt Creator 2.4.1
-
None
Description
Qt Creator 2.4.1 does not seem to take into account header file dependencies when deciding whether or not to regenerate Makefiles. This means that in ordered subdirs projects containing apps and staticLibs, changing the names of header files in the staticLibs does not lead to it regenerating the Makefiles for the apps when old Makefiles already exist for them, which causes build errors.
E.g. suppose we're developing a static library "statlib" and an application "app-code" that uses it:
TEMPLATE = lib CONFIG += staticLib HEADERS += statlib.h SOURCES += statlib.cpp
TEMPLATE = app SOURCES += main.cpp LIBS += -L../statlib -lstatlib
TEMPLATE = subdirs CONFIG += ordered SUBDIRS = statlib app-code
Also, suppose app-code's main.cpp file uses statlib's header.h file:
#include "../statlib/statlib.h" // ...<application code>...
Suppose we open app.pro and build it. Next, suppose we rename statlib.h mystatlib.h and change the statlib.pro and main.cpp files accordingly. Qt Creator will see that statlib.pro has changed, and so will regenerate statlib's Makefile before recompiling it. But since renaming statlib.h did not change app-code/app-code.pro, it will not regenerate app-code's Makefile before recompiling app-code. So when it attempts to recompile app-code, it will use app-code's old Makefile, which says that main.o depends on statlib.h. This leads to the following make error: make[1]: *** No rule to make target `../statlib/statlib.h', needed by `main.o'. Stop.
The workaround is to just manually delete app-code's Makefile and run "build" again. But it would be preferable if Qt Creator would handle this itself.
I have attached a compilable form of the example above (in the state preceding the renaming of statlib.h).
Attachments
Issue Links
- is replaced by
-
QTCREATORBUG-231 Creator should know when to rerun qmake
-
- Closed
-