0

Please do not mind the strangeness of the following minimal example (I would have to make it much larger to justify why I am doing things this way):

File test.cpp:

#include "a.h"

int main() {
  return 0;
}

File a.h:

namespace N { // without namespace all is well!
#include "b.h"
}

File b.h:

/// \file

/// Documentation of CMD
#define CMD 5

Doxygen 1.8.11 complains:

warning: Member CMD (macro definition) of file a.h is not documented.

Why doesn't Doxygen see the description of CMD and how do I fix this?

AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68
  • Unrelated to your problem, and without knowing anything about the actual code, but you do know that macros can't be scoped? The preprocessor directives are its own little language and kind of separate from the C++ code. – Some programmer dude Nov 02 '16 at 14:49
  • Yes, I know that `CMD` is not in the namespace. In the real code, `b.h` contains classes that are in the namespace. – AlwaysLearning Nov 02 '16 at 14:50
  • Okay, just checking. :) Some people seems to have trouble understanding it. – Some programmer dude Nov 02 '16 at 14:54
  • Perhaps doxygen is getting confused by the namespace? *Why* are you including the header inside a namespace? It would be much more natural to put the namespace inside the header. – Martin Bonner supports Monica Nov 02 '16 at 15:37
  • @MartinBonner In the real code, quite a few headers are included there. I want to make sure that all the facilities defined in these headers are in the namespace and none is forgotten. – AlwaysLearning Nov 02 '16 at 17:42
  • That feels like the wrong way to do it. You will have to put the namesakes wrapper round *every* time you include the header. Any corresponding cpp file will have to mention the namespace anyway. – Martin Bonner supports Monica Nov 02 '16 at 21:02
  • Not sure what is going wrong but maybe the answers on http://stackoverflow.com/questions/2356120/documenting-preprocessor-defines-in-doxygen will help. – Bowie Owens Nov 03 '16 at 04:29
  • @MartinBonner It is a header-only library, where namespaces mimic the folder structure. Without this technique, each file in a nested folder would begin with by opening 3-4 namespaces, of which all but one would be same in all the headers of the folder. – AlwaysLearning Nov 03 '16 at 05:58
  • @BowieOwens Thank you for the link, but it does not provide any clue. – AlwaysLearning Nov 03 '16 at 06:01

0 Answers0