您知道项目文件中包含文件的工具构建树吗?

Do you know tool building tree of include files in projectfile?(您知道项目文件中包含文件的工具构建树吗?)

本文介绍了您知道项目文件中包含文件的工具构建树吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说,我想要一个工具(或脚本?)获取项目(或 .h 文件)并构建包含在其中的包含"的可搜索树(包含到包含到等等).有没有这样的东西?我应该自己写这个吗[当然我是:),但可能有人已经写好了,或者可能知道如何得到它]?

Say, I'd like to have a tool (or script?) taking project (or .h file) and building searchable tree of "includes" included into it (of included into of included into and so so on). Is there exist something like this? Should I write this by myself [of course I am :), but may be somebody had it already written or may be has an idea how to get it]?

推荐答案

不完全确定这是您想要的,但是您可以通过从基础 c 生成后 CPP 处理的文件轻松获得包含列表文件,并 grepping 出文件/行号注释,例如,使用 gcc

Not entirely sure this is what you're after, but you can easily get a list of includes by generating the post-CPP-processed file from the base c file, and grepping out the file/line number comments, e.g., using gcc

gcc -E main.c {usual flags} | grep '#' | cut -d' ' -f3 | sort | uniq

其中 main.c 是您的基本 c 文件.

where main.c is your base c file.

这篇关于您知道项目文件中包含文件的工具构建树吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:您知道项目文件中包含文件的工具构建树吗?

基础教程推荐