Doxygen comments on undeclared functions in C ++ headers

I have code with member functions defined in a .cpp file that are not declared in a .h file. Contrary to what I expect, it compiles without any problems.

I want to generate some documentation with Doxygen, but the comments that I add before member functions that are not declared in the header file do not seem to be recognized by Doxygen.

Is there a workaround for this problem other than defining functions in the header file?

+1
source share
1 answer

I have code with member functions defined in a .cpp file that are not declared in a .h file. Contrary to what I expect, it compiles without any problems.

Do you mean this?

// Foo.h class Foo { void bar (); // no method "meh". }; // Foo.cpp int Foo::meh (const std::string& message) { // ... }; 

Because it should not be compiled.

If you mean this:

 // Foo.h void bar (); // no function "meh". // Foo.cpp int meh (const std::string& message) { // ... } 

Then it's great (free features do not require an ad in the header file).


I want to generate some documentation with Doxygen, but the comments that I add before member functions that are not declared in the header file do not seem to be recognized by Doxygen.

It depends on the configuration of Doxygen. Make sure you set the INPUT_PATTERNS parameter to include both source files and header files. Also, make sure that stand-alone function commands explicitly reference a character (for example, use the @fn meh command to document the meh function).

0
source

Source: https://habr.com/ru/post/1446744/


All Articles