如何正确使用#include指令? [英] How to use #include directive correctly?
本文介绍了如何正确使用#include指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有关于如何的#include
正确使用任何材料?
我没有找到任何C / C ++文本详细说明了这种用法的书。
在正式的项目,我总是感到困惑在处理它。
Is there any material about how to use #include
correctly?
I didn't find any C/C++ text book that explains this usage in detail.
In formal project, I always get confused in dealing with it.
推荐答案
- 从约翰洛科什检查大型C ++软件设计,如果你有没有钱。
- 谷歌C ++编码规范也有一些东西OK
- 检查萨特草本材料在线(博客)也是如此。
基本上你需要明白的地方包括报头不是必需的,如。向前声明。也可以尝试以确保包含文件编译一个接一个,只有放.h文件#包括当它是一个必须的(如模板)。
Basically you need to understand where include headers are NOT required, eg. forward declaration. Also try to make sure that include files compiles one by one, and only put #includes in h files when it's a must (eg. templates).
这篇关于如何正确使用#include指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文