GNA
GNA

Reputation: 635

sphinx + breathe + doxygen: .. doxygendefine:: only works for header files

I have a C project which I'm documenting with sphinx + breathe + doxygen.

I want to document a define using

.. doxygendefine:: MY_DEFINE

This works fine, as long as MY_DEFINE is defined inside a .h file. When it is moved to a .c file, sphinx tells me

doxygendefine: Cannot find define “MY_DEFINE” in doxygen xml output for project ...

Looking at the XML files generated by doxygen reveals, that the define's documenation is inside the XMLs. I then tried to use

.. doxygenfile:: file.c

which generates the whole documentation for the file. In this documantation oputput the define MY_DEFINE is present.

I don't think the problem lies in my doxygen setup. Does it?

Is there a configuration for breathe that results in this behavior?

How can I fix this? It's driving me crazy, that documenting stuff from source files does not work.

Btw: Documenting functions also only works if they are defined inside a header file. static functions in C files are not found either (although present in doxygen's XML output)

Upvotes: 2

Views: 2071

Answers (1)

GNA
GNA

Reputation: 635

I read the docs once more and realized, that breathe does not search "implementation" files.

This behavior is controlled by the

breathe_implementation_filename_extensions = ['.c', '.cc', '.cpp']

config variable. If I exclude C files from that list, the define is found. However, breathe somehow doesn't like if you have both a header file and a C file inside your documentation containing prototypes and implementations.

I guess the breathe + sphinx combo is just useless to me and I will stick to doxygen for the time.

Upvotes: 3

Related Questions