怎样可以快速搜索项目中的所有包含的头文件为特定功能或宏? [英] How can I quickly search all included header files in a project for a specific function or macro?

查看:170
本文介绍了怎样可以快速搜索项目中的所有包含的头文件为特定功能或宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有一个问题,我最近有这样只是必须有一个共同的痛苦别人在这里。

Here's a problem I've had recently that just HAS to be a common pain to others here.

我与别人的传统的C code工作,需要找到被定义一个函数或宏。在code 的#include 是个一串除了那些从具体项目不同的标准体系库。

I'm working with someone else's legacy C code and need to find where a function or macro was defined. The code #includes a bunch of different standard system libraries in addition to those from the specific project.

是否有工具或技术来快速寻找到一个特定的功能,宏(或其他全球性的这个问题)的定义?

Is there a tool or technique to quickly find where a specific function, macro, (or other global for that matter) was defined?

我试过:

grep -R 'function' /usr/lib

和其他类似的* nix / bash的福只取得有限的成功和许多恼人的糠宰杀的。你们中的一个圣人codeRS那里必须有一个很好的解决了这个看似常见的场景。

and other similar *nix/bash-fu with only limited success and lots of annoying chaff to cull. One of you sage coders out there must have a good solution to this seemingly common scenario.

我很惊讶地找不到关于这里这个特殊的疼痛或在我的interwebs的搜索另外一个问题。 (我敢肯定,会有愤怒的评论,如果我错过了...; - ))

I was very surprised to not find another question on this particular pain here or in my searches of the interwebs. (I'm sure there will be angry comments if I missed one... ;-))

在此先感谢任何提示!

推荐答案

使用的ETag / 的ctags 从< A HREF =htt​​p://ctags.sourceforge.net/相对=nofollow>旺盛的ctags项目结合的编辑器(Emacs的,VIM)能够理解他们,或者的 GNU GLOBAL 的。

Use etags/ctags from the exuberant ctags project in conjunction with an editor (emacs, vim) that understands them, or GNU GLOBAL.

哦,如果你碰巧使用automake它生成一个目标标记。因此,无需复杂的手动调用 {C,E}代码

Oh, and if you happen to use automake it generates a target TAGS. So no need for complicated manual calls to {c,e}tags.

这篇关于怎样可以快速搜索项目中的所有包含的头文件为特定功能或宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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