54

I've spent some time reviewing the docs and going through my doxy config file from end to end. I cut doxygen loose on my config file and it produces documentation and indices for structs and cpp classes but I don't see call or caller graphs for the multitude of c functions in my source tree.

Can anybody tell me how to configure doxygen to produces these call and caller trees ? I do have graphviz installed.

BЈовић
  • 62,405
  • 41
  • 173
  • 273
user501138
  • 869
  • 2
  • 9
  • 16

5 Answers5

63

You have to set HAVE_DOT, CALL_GRAPH and CALLER_GRAPH to YES. Also make sure the path to dot is in your PATH variable.

If that still doesn't work, you might have to set EXTRACT_ALL and/or EXTRACT_STATIC, depending on your functions.

pezcode
  • 5,490
  • 2
  • 24
  • 37
  • Apologies, I do have HAVE_DOT, CALL_GRAPH, and CALLER_GRAPH set to YES. By "PATH variable" I assume you mean in my shell because there doesn't appear to be one in my doxy cfg file. Yes, dot is in my path (i.e. 'which dot' works). I had not set EXTRACT_ALL or EXTRACT_STATIC. From the comments it doesn't seem like these would be relevant but I'm trying now. Thanks for your response. – user501138 Jan 17 '12 at 19:51
  • 1
    If for some reason doxygen can't find dot, you can manually set the path via `DOT_PATH` in your Doxyfile. – pezcode Jan 17 '12 at 21:35
  • This worked for me too. I'm disappointed that the Doxygen developers haven't thought through the default configuration values more carefully. – Sridhar Sarnobat Oct 14 '13 at 19:56
  • 8
    `EXTRACT_ALL` and `EXTRACT_STATIC` worked for me too. – flyrain Dec 23 '13 at 08:05
  • Yes, EXTRACT_* were also missing in mine. – Sridhar Sarnobat Jun 16 '14 at 19:00
12

For MacOS users:

Install Doxygen and Graphviz as:

brew install doxygen
brew install graphviz

Go to your project folder, and from Terminal set to this path run

doxygen -g

A doxygen file will be generated, named as Doxyfile. Go ahead and open up this file in any editor and find these parameters and replace their values to YES at their locations:

HAVE_DOT               = YES
EXTRACT_ALL            = YES
EXTRACT_PRIVATE        = YES
EXTRACT_STATIC         = YES
CALL_GRAPH             = YES
CALLER_GRAPH           = YES
DISABLE_INDEX          = YES 
GENERATE_TREEVIEW      = YES
RECURSIVE              = YES

You can also set name of your project in this Doxyfile. Save the file and then run this command in the terminal:

doxygen Doxyfile

This will generate two more folders named as html and latex. Go to the html folder and open annotated.html to view all details of your project. You will also view png images of the call graphs embedded in the html that are relevant (to some functions/classes for example).

Trees
  • 1,245
  • 10
  • 20
6

Setting the path to "dot" (/usr/local/bin/) via the "Expert" tab controls in the GUI did the trick!

mckillip
  • 61
  • 1
  • 1
6

doxywizard is also useful. It gives you all the options in a GUI. Selecting any option shows quick help about that option.

You might also be interested in COLLABORATION_GRAPH or GRAPHICAL_HIERARCHY.

Quite convenient.

Kevin
  • 16,549
  • 8
  • 60
  • 74
kikeenrique
  • 2,589
  • 2
  • 25
  • 46
1

I had the same problem for my C global functions. Enabling CLANG_ASSISTED_PARSING did help display callgraphs for some functions, yet not all of them.

Michael Fayad
  • 1,216
  • 1
  • 17
  • 38