Finding a function / method in a large C/C++ project

This post was written by eli on May 24, 2013
Posted Under: Linux,Software

So there’s this huge pile of source code, with an enormous amount of functions and methods. How can you quickly find where each is defined? IDEs has this functionality built in, but it’s not so easy to push an already existing (and huge) project into an IDE.

The solution is so simple. For example,

$ ctags -f sourcemap -R OpenCV-2.4.0/

which will scan the OpenCV-2.4.0 directory for source file, parse them, and create a textual file, sourcemap, with (probably) all method and function definitions listed in alphabetical order. With the files they were found in. The format isn’t very human-friendly, but still quite easy to find the answer in.

Add a Comment

required, use real name
required, will not be published
optional, your blog address