I have used Doxygen for years with C++ code. I'd like to use it with some C code that I'm working on, but the output is less than optimal. The "Classes" tab in the top bar shows only the struct
definitions, not the functions in the file. I have to click on the "Files" tab and then the name of the header file to view the functions it contains.
Is there any way to modify the output of Doxygen so that it is more suitable to code written in C? Or at the very least, remove the "Classes" tab and provide only the "Files" view?
The Doxygen structural command to use is “@mainpage” as shown in the example above. This tag on one of our markdown files will tell the Doxygen parser that a given markdown file is the main page for the project. This is the page shown when you click index. html from the HTML folder generated by Doxygen.
Putting the command @brief will generate a short description of the function when you generate the doxygen documentation. That short description can be extended if you want.
Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice flavors), Fortran, and to some extent D.
Once specified, you can generate the comment stub by typing the respective “///” or “/**” above a function, or by using the (Ctrl+/) shortcut.
You can set
OPTIMIZE_OUTPUT_FOR_C = YES
in the config file, to get output that is more C oriented.
If you create a layout file in addition to the normal config file:
doxygen -l layout.xml
You can edit that; this controls the basic format of the interface. If you want to remove the "Classes" tab, locate:
<tab type="classes" visible="yes" title="Types">
[...]
</tab>
And remove it or change visible
to "no".
C functions and datatypes are usually grouped together in files in a non-random way, so the "Files" tab alone may be sufficient for you. If not, use groups:
\ingroup foobar
Can be added to struct and function definitions, etc. You then need a
\defgroup foobar Description of foobar.
somewhere. This will then be used by
<tab type="modules" visible="yes" title="Modules" intro=""/>
From layout.xml
, producing a possibly more intuitive interface than "Files" (e.g., struct documentation from a .h
and function documentation from a .c
are organized together if they are in the same group), akin to how "Classes" works with C++.
There's more about this stuff in the doxygen site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With