请教一个问题:头文件的包含要按什么规则?为什么有的时候要放在其它头文件的前面,有时候多个文件包含某个头文件就会说xx符号重定义...
像visual leak detector 10 的文档中有下面这样一段话, 而且<vld.h>被多个文件包含时,会出现 "xx符号在xxx.obj中已经定义" 的情况In the source file containing your program's main entry point, include the vld.h header file. It's best, but not absolutely required, to include this header before any other header files, except for stdafx.h. If the source file includes stdafx.h, then vld.h should be included after it.
重点是其中的这句 "to include this header before any other header files"
而visual leak detector 19d 而又这样说Note: Unlike earlier versions of VLD, it is now acceptable to include vld.h in every source file, or to include it in a common header that is included by many or all source files. Only one copy of the VLD code will be loaded into the process, regardless of how many source files include vld.h.
这是为什么?谢谢