views:

1491

answers:

21

I am working with a very large code in C/C++. Indexing and referencing is a must in this environment. What tools would you recommend for viewing/browsing the code? Preferably open source. I tried CDT for indexing but it is useless. Other tools I've tried is cscope, but it does not work well with C++...

+25  A: 

Doxygen. It parses all files, generates nice HTML you can browse easily. I used it to crack some really large codebases - from scratch. Once you start using it a lot, it helps to format comments in your code, so doxygen can create documentation.

It can also create class dependency diagrams.

It's open source under GPL license.

Milan Babuškov
Commenting the code to provide additional documentation isn't as painful as writing a document for developers. MMMm post-documentarians... *drool*
Kieveli
A: 

What environment? Windows/VisualStudio? Linux?

For Windows/VisualStudio we've bought VisualAssists. Worth every cent. And all of us disabled IntelliSense right away.

Marcin Gil
+2  A: 

If you use emacs, you could use etags to index your code and then the tag table facilities to navigate through your source code. There is an help page for Tags in the info windows of Emacs.

stephanea
+15  A: 

ctags and good ol' vim?

Daren Thomas
A: 

If it's possible to pull the code into a Visual Studio solution, then there are some great features for browsing around the code.

If that isn't possible, Doxygen is a great way to go once you get your configuration file set up. I've used it successfully on fairly large codebases (hundreds of files, 100K+ lines of code).

+1  A: 

Have a look at the LXR engine. It is not easy to set up, but the result is worth the pain I think. You just have to click on a function to know where it is defined, and where it is referenced.

shodanex
+3  A: 
PW
+3  A: 

See source navigator

Iulian Şerbănoiu
+4  A: 

Source Insight is really good, but not open source.

XTL
Source Insight rocks. Nothing else I tried comes close when browsing, searching and navigating through millions of lines of code.
Remus Rusanu
+1  A: 

Vor vim lovers, you should try the pair exuberant-ctags and OmniCppComplete (http://www.vim.org/scripts/script.php?script_id=1520).

Ctags works pretty fine when running with the following options:

--languages=C,C++ --c++-kinds=+plx --fields=+iaS --extra=+q -I__THROW,__NTH+,__wur,__warnattr, __nonnull, __attribute_malloc__, __attribute_pure__, __attribute_used__, __attribute_noinline__, __attribute_deprecated__, __attribute_format_arg__, __attribute_format_strfmon__, __attribute_warn_unused_result__, __always_inline,__extern_inline, __extension__, __restrict

A: 

I use Eclipse Ganymede which is "equipped" with CDT 5 - I find that there is a big progress since CDT 4 and source indexing works fine for me. I work on a big (and pretty messy) project which builds on both Linux and Windows and I found that CDT 5 indexes it better than VS2005/2008.

Probably you should play around with source location settings, preprocessor directives for indexer, etc.

theJonan
A: 

Source insight.... it rocks with beautiful browsing shortcuts.. I never use mouse....

siri
A: 

Another good tool - and there's a free version - is Understand for C++. See this link for more info.

I've used it a lot in the past, and it was a real help in getting up the learnign curve for a large source base.

Greg Whitfield
+6  A: 

CScope is also wonderful.
http://cscope.sourceforge.net/

FreeMemory
A: 

Etags and Emacs.

jfm3
+1  A: 

Source Insight or Understand for C++, although both are not freewares. Trial versions of each are available lasting 30 and 15 days respectively.

Source Insight does indexing on the fly, I mean you edit the code and its indexed. Whereas we need to tell Understand for C++ to re-parse the code when its edited. Understand generates exhaustive report of the source base, which could be used for static analysis. We mainly focus on reducing Cyclomatic complexity.

In earlier days, I used to use browse info capability in MS Visual C++ 6.0.

yogeesh
A: 

I`ve used Vissual Assist (www.wholetomato.com/) and Understand for C++.

First is VC++ addon. Make browsing code really easy. Helps navigate and understand code. Understand for C++ is a separate tool. Use it rarely, mainly when start work with legacy code base.

A: 

Source Insight. Yes it costs a few hundred bucks, but you only buy it one time. And the manufacturer spends that money well designing a simple, elegant editor that does THE 3 things anyone could want, in an EDITOR, not just a browser:

  1. Real time generation of the tree of your code
  2. Full syntax highlighting for 10s of languages (and you can add your own)
  3. An interface to external tools that works all the time (unlike, forgive me, VS6,8,9)

I cannot figure out why the company is so quiet, and why more people haven't picked up on it.

talkaboutquality
A: 

My colleagues swear by Glimpse (the non-'web' part of WebGlimpse, and the engine underlying LXR).

A: 

Our language-sensitive source code search engine can be found at SD Source Code Search Engine. It can handle many languages at the same time. Searches can be performed for patterns in a specific langauge, or patterns across languages (such as "find identifiers involving TAX"). By being sensitive to langauge tokens, the number of false positives is reduced, saving time for the user. It understands C, C++, C#, COBOL, Java, ECMAScript, Java, XML, Verilog, VHDL, and a number of other languages.

Ira Baxter
A: 

Sourceinsight is the best!!! It is a great tool for C/C++/Java reverse engineering, source code indexing and large scale source code browsing. I am using it for 5 years to browse large source projects over 1 million lines of code.

equinox