[英]How to find all the files that use a particular header in a specified directory on Linux?
I have huge directory with makefiles, .c, .h .cpp etc. The final output (binary) is built using make.我有一个很大的目录,里面有 makefile、.c、.h 和 .cpp 等。最终的输出(二进制)是使用 make 构建的。
To do that I have to find and investigate the source files that use <aio.h>
and <execinfo.h>
headers.为此,我必须查找并调查使用
<aio.h>
和<execinfo.h>
标头的源文件。 So how do I find the files that use #include <aio.h>
and #include <execinfo.h>
那么如何找到使用
#include <aio.h>
和#include <execinfo.h>
For browsing big code, cscope or ctags is used.浏览大代码时,使用 cscope 或 ctags。 Both needs to generate database.
两者都需要生成数据库。 For cscope it can be done by command cscope -bq -k and later cscope-d will give console menu for search options.
对于 cscope,它可以通过命令 cscope -bq -k 完成,稍后 cscope-d 将提供用于搜索选项的控制台菜单。 Find or grep will be slow for browsing of big code.
Find 或 grep 浏览大代码会很慢。
find . -name '*.c (or*.h)' -exec grep "thing_to_Search_for" '{}' \; -print
这个命令帮助我实现了我需要的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.