[ACCEPTED]-C++ source tagging-c++

Accepted answer
Score: 39

Are you sure you called ctags with the right 37 options? For C++, I use:

ctags --c++-kinds=+p --fields=+iaS --extras=+q --language-force=C++

This is what the 36 documentation has to say about the --c++-kinds=+p option:

When 35 parsing a C++ member function definition 34 (e.g. "className::function"), ctags 33 cannot determine whether the scope specifier is 32 a class name or a namespace specifier and 31 always lists it as a class name in the 30 scope portion of the extension fields. Also, if 29 a C++ function is defined outside of the 28 class declaration (the usual case), the access 27 specification (i.e. public, protected, or 26 private) and implementation information 25 (e.g. virtual, pure virtual) contained in 24 the function declaration are not known when 23 the tag is generated for the function definition. It 22 will, however be available for 21 prototypes
(e.g --c++-kinds=+p).

The --fields=+iaS option:

 a   Access (or export) of class members
 i   Inheritance information
 S   Signature of routine (e.g. prototype or parameter list)

The 20 --extras=+q option:

Because, by default, ctags only 19 generates tags for the separate identifiers 18 found in the source files. If you specify 17 the --extra=+q option, then ctags will also 16 generate a second, class-qualified tag for 15 each class member (data and function/method) in 14 the form class::member for C++, and in the 13 form class.method for Eiffel and Java.

The 12 --language-force=C++ option:

By default, ctags automatically 11 selects the language of a source file, ignoring 10 those files whose language cannot be determined 9 (see SOURCE FILES, above). This option forces 8 the specified language (case-insensitive; either 7 built-in or user-defined) to be used for 6 every supplied file instead of automatically 5 selecting the language based upon its extension. In 4 addition, the special value auto indicates 3 that the language should be automatically 2 selected (which effectively disables this 1 option).

Score: 9

use doxygen its a great tool to browse code and 6 see classes and members relations with 5 each other. the tool produces clickable 4 html output for your source code with references 3 for each usage. you can compile it to a 2 searchable chm file or use a web server 1 to search the code for keywords.

Score: 1

Try GNU global http://www.gnu.org/software/global/

It can generate navigate:able 3 web pages of your source code as well as 2 having support for vim and a command line 1 interface that is often useful.

Score: 0

I've no experience with this, but I have 6 used Doxygen to browse the source code of complex 5 projects. Just run it with all the settings 4 turned on, and it will generate call graphs, callee 3 graphs, reference and referenced-by relations, template 2 instantiations, etc. Output formats include 1 HTML, LaTeX, CHM, POD

Hope this works!

Score: 0

For a while I have been mixing different 18 tools for this purposes. Vi is a great editor 17 and you can run it over remote computers 16 without hassles, but the completion information 15 is not semantical.

When confronted with a 14 big problem I tend to use either Eclipse 13 CDT or QTCreator, in both cases the latest 12 versions, versions from a year back are 11 not really so nice. QTCreator is a lightweight 10 tool, but I have been quite impressed on 9 its ability to analyze the code. Eclipse 8 CDT is heavier weight, but I am a little 7 more used to the interface, so at the end 6 I tend to use it.

The project I am working 5 on is compiled within a separated sandbox, where 4 none of those two IDEs can be used, but 3 you can get a copy of the repository just 2 for analysis and use the IDE just as a browsing 1 tool.

More Related questions