是否有工具,帮助组织#包括? [英] Are there tools that help organizing #includes?

查看:95
本文介绍了是否有工具,帮助组织#包括?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有帮助组织属于在.C或.h文件中顶部的的#include 取值任何工具?

Are there any tools that help organizing the #includes that belong at the top of a .c or .h file?

我只是想知道,因为我重组我的code,从一个长文件移动各种小函数的定义/声明成不同的小文件。现在每个较小的文件需要一个均在长文件的顶部的#include s的子集。

I was just wondering because I am reorganizing my code, moving various small function definitions/declarations from one long file into different smaller files. Now each of the smaller files needs a subset of the #includes that were at the top of the long file.

这只是烦人,容易出错的手工计算出所有的#includes。通常情况下,code编译即使不是全部的#include 是那里。例如:file A使用的std ::矢量广泛但不包括矢量;但它目前包括这恰好包括矢量(也许通过一些递归包括)。一些不起眼的其他头

It's just annoying and error-prone to figure out all #includes by hand. Often the code compiles even though not all #includes are there. Example: File A uses std::vector extensively but doesn't include vector; but it currently includes some obscure other header which happens to include vector (maybe through some recursive includes).

推荐答案

VisualA​​ssistX可以帮助你跳跃到一个类型的定义。例如。如果你在你的源使用MyClass类,你可以单击它,选择转到定义,VisualA​​ssistX打开包含文件,其中包含这个类(可能的Visual Studio也可以做到这一点的定义,但在这一点上我这样习惯VisualA​​ssistX,我贡献每一个精彩功能VisualA​​ssistX :-))。您可以使用此找到包括必需的文件为源$ C ​​$ C。

VisualAssistX can help you jumping to the definition of a type. E.g. if you use a class MyClass in your source, you can click it, choose goto definition, and VisualAssistX opens the include file that contains the definition of this class (possibly Visual Studio can also do this, but at this point am so getting used to VisualAssistX, that I contribute every wonderful feature to VisualAssistX :-)). You can use this to find the include file necessary for your source code.

PC-林特可以做的完全相反。如果您有没有被使用在源一个包含文件,PC-林特可以提醒你一下,让你知道,包含文件可以从源(这将会对你的编译时间产生积极的影响)中移除

PC-Lint can do exactly the opposite. If you have an include file in your source that is not being used, PC-Lint can warn you about it, so that you know that the include file can be removed from the source (which will have a positive impact on your compilation time).

这篇关于是否有工具,帮助组织#包括?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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