Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-8012

Qt Creator does not always regenerate Makefiles when header files are renamed

    XMLWordPrintable

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:

      statlib/statlib.pro
      TEMPLATE = lib
      CONFIG += staticLib
      HEADERS += statlib.h
      SOURCES += statlib.cpp
      
      app-code/app-code.pro
      TEMPLATE = app
      SOURCES += main.cpp
      LIBS += -L../statlib -lstatlib
      
      app.pro
      TEMPLATE = subdirs
      CONFIG += ordered
      SUBDIRS = statlib app-code
      

      Also, suppose app-code's main.cpp file uses statlib's header.h file:

      main.cpp
      #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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              dt Daniel Teske
              ose Ose Pedro
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes