Make在更改时不重建头 [英] Make doesn't rebuild headers when changed

查看:127
本文介绍了Make在更改时不重建头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我定期修改标题,当我这样做,忘记 make clean 然后 make ,我得到各种奇怪的行为。我目前使用Qt Creator作为我的IDE,但我看到这发生在一个Qt独立的项目。我的项目变得相当大,并且不得不重建每次我做一个头更改是变得无效率。

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?

以后参考:

如果使用QMake系统:

If using the QMake system:


DEPENDPATH += . \
    HeaderLocation1/ \
    HeaderLocation2/ \
    HeaderLocation2/HeaderSubLocation1/ \
    HeaderLocation2/HeaderSubLocation2/ \
    HeaderLocation2/HeaderSubLocation3/ \
    HeaderLocation2/HeaderSubLocation4/ \
    HeaderLocation2/HeaderSubLocation5/ \
    HeaderLocation3/ \
    HeaderLocation3/HeaderSubLocation1/ \
    HeaderLocation3/HeaderSubLocation2/ \


推荐答案

不知道任何关于IDE的东西,不知道是否相关,并且因为你不包括你的makefile -

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?

对于g ++,我使用 -MD flag,然后在makefile中包含 $(wildcard bin / *。d)(取决于你的目标文件的创建位置,

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')

同时请务必在清除版本中删除dep文件

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

这篇关于Make在更改时不重建头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆