Linux中的C类的层次结构/依赖关系图生成器

是否有一些工具通过检查 Linux中的C代码生成类层次结构/依赖关系图?

我有这么大的C文件收集给我,这样一个工具将是无价的帮助我
了解源代码.我有点纠结了解它.

解决方法

尝试 doxygen.它也可能与您的发行版一起发货.

您可能需要GraphViz生成图形.有a simple exampleoutput.

这是由doxgen生成的图例文件中的一个更复杂的例子:

代码(注意:如果只想生成图形,则不需要注释.):

/*! Invisible class because of truncation */
class Invisible { };

/*! Truncated class,inheritance relation is hidden */
class Truncated : public Invisible { };

/* Class not documented with doxygen comments */
class Undocumented { };

/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };

/*! A template class */
template<class T> class Templ { };

/*! Class that is inherited using protected inheritance */
class ProtectedBase { };

/*! Class that is inherited using private inheritance */
class PrivateBase { };

/*! Class that is used by the Inherited class */
class Used { };

/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,protected ProtectedBase,private PrivateBase,public Undocumented,public Templ<int>
{
  private:
    Used *m_usedClass;
};

结果:

您不需要对代码进行评论来生成这些图形.第一个例子根本没有任何意见.第二个例子有一个没有Doxygen风格评论的类.只需设置相应的参数(至少应该设置EXTRACT_ALL = YES),我不记得是否需要这样做).

相关文章

文章浏览阅读1.8k次,点赞63次,收藏54次。Linux下的目录权限...
文章浏览阅读1.6k次,点赞44次,收藏38次。关于Qt的安装、Wi...
本文介绍了使用shell脚本编写一个 Hello
文章浏览阅读1.5k次,点赞37次,收藏43次。【Linux】初识Lin...
文章浏览阅读3k次,点赞34次,收藏156次。Linux超详细笔记,...
文章浏览阅读6.8k次,点赞109次,收藏114次。【Linux】 Open...