Make doesn't rebuild headers when changed

c++, compilation, header-files, makefile, qt

Solution

Dont know anything about your IDE, and not sure if its relevant, and since you are not including your makefile - I'll just state the obvious - do you use any auto-generated dependencies?

For g++ I use the `-MD` flag, then in the makefile include `$(wildcard bin/*.d)` (depending on where your object file is created, mine are created in 'bin')

Also make sure to delete the dep file on a clean build

Problem

I have a project for which I regularly modify headers and when I do so, and forget to `make clean` then `make`, I get all sorts of weird behavior. I'm currently using Qt Creator as my IDE, but I've seen this happen on a Qt-independent project. My project is getting fairly large, and having to rebuild every time I make a header change is becoming unproductive. Any thoughts? For future reference: If using the QMake system: ``` DEPENDPATH += . \ HeaderLocation1/ \ HeaderLocation2/ \ HeaderLocation2/HeaderSubLocation1/ \ HeaderLocation2/HeaderSubLocation2/ \ HeaderLocation2/HeaderSubLocation3/ \ HeaderLocation2/HeaderSubLocation4/ \ HeaderLocation2/HeaderSubLocation5/ \ HeaderLocation3/ \ HeaderLocation3/HeaderSubLocation1/ \ HeaderLocation3/HeaderSubLocation2/ \ ```

Original source