关于宏和Makefile的疑问
c++吧
全部回复
仅看楼主
level 11
gameloftyou 楼主
1.编译器是按cpp分开编译的,所以cpp里面的宏是局部的不能跨cpp,
#ifndef …#
define…#endif…这种写法也是防止同一cpp内头文件被重复包含,这句话对么?
2.Makefile中目标靠依赖项自动更新是怎么实现的,另外假如我要生成main.o则可能我的依赖项是main.cpp main.h但是如果main.h又包含了a.h,那么我是否我应该把a.h也作为依赖项? 写成main.o:main.h a.h main.cpp,这样岂不是很麻烦? 还是说make工具能移动推断出main.h包含了a.h,当a.h变化时也更新main.o?
2013年04月13日 05点04分 1
level 10
g++ -E 这个可以输出依赖项...
2013年04月13日 05点04分 2
gcc还有这功能?
2013年04月13日 05点04分
[吐舌]这个还真没用过
2013年04月13日 05点04分
口胡明明是g++ -MM
2013年04月13日 05点04分
回复 RichSelian :好吧记错了...
2013年04月13日 06点04分
level 15
translation unit
2013年04月13日 06点04分 3
1