2

I'm using Doxygen to document my C++ code. All are well outputted in HTML format, except attributes/variables like below are not(not at all).

    /**
     * Flag to check whether the variable is once initialized or not
     */
     bool initialized_;

Any idea what could go wrong?

EDIT

initialized_ is a class member variable.

1
  • A vague question perhaps, but I knew what you meant since I am encountering this too. Commented May 25, 2021 at 23:24

2 Answers 2

5

I'm not sure if this will solve your problem, since you have given very little information about the variable initialized_ (is it a global variable, is it part of a class etc.) but the doxygen documentation (see under the heading Documentation at other places) states that

To document a member of a C++ class, you must also document the class itself. The same holds for namespaces. To document a global C function, typedef, enum or preprocessor definition you must first document the file that contains it (usually this will be a header file, because that file contains the information that is exported to other source files).

Let's repeat that, because it is often overlooked: to document global objects (functions, typedefs, enum, macros, etc), you must document the file in which they are defined. In other words, there must at least be a

/*! \file */ 

or a

/** @file */ 

line in this file.

Sign up to request clarification or add additional context in comments.

6 Comments

Do you mean should include this line in the header(the interface) or in my implementation file. It's still not printed though.
The documentation is pretty clear: if the variable is a global object then the file in which it is defined must be documented (with \file). If the variable is a member of a class, the class itself must be defined. Since you updated your question so state that initialised_ is a class member, have you documented that class?
You mean just before class declaration, I document it by putting @brief, @param etc.? If that you meant, I did already that.
Ok, so that class shows up in the documentation, but the variable initialised_ does not show up in the "Public Attributes" list, is this right?
By private do you mean it is not in the list I mentioned, or you have explicitly declared it as a private attribute? If it is a private attribute, then you need to set EXTRACT_PRIVATE equal to YES in you configuration file
|
0

This might also help people looking for answers:

# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
# The default value is: NO.

RECURSIVE              = YES

in your Doxyfile file

I am using doxygen and the Doxygen GUI Frontend (Doxywizard) version 1.8.9.1 for OS X. There is also a checkbox for scanning recursively you can enable. This was not enabled by default.

./doxygen -x
error: Unknown option "-x"

5 Comments

I don't directly see how this could solve the issue at hand and as you commented with the original question "A vague question perhaps, but I knew what you meant since I am encountering this too. ", I think that a small complete example (including Doxyfile settings different from the default settings i.e. doxygen -x) and the doxygen version (doxygen -v_ would be very beneficial.
@albert I had variables with qt doxygen comments describing their purpose which were not appearing in the generated documentation, as per the asker. They weren't being documented, even after using \file to include them. By changing the RECURSIVE variable to YES, I re-ran doxygen and it pulled in the variable into the html docs. That's how it solved the issue at hand: variables got documented using Doxygen. I will update my answer with details.
A few remarks: the 1.8.9.1 version is old (January 2015), I certainly would advise to update to a newer version (the current version is 1.9.1). The fact that doxygen -x doesn't work is due to the old version, the -x option has been added later. The fact that your files weren't documented was due to the fact that they weren't even considered as they weren't mention in your INPUT setting and by setting RECURSIVE the files in the subdirectories are considered as well (besides maybe the necessity of the \file, but the major problem was that they weren't considered at all).
@albert I am using 1.8.9.1 because it is, afaik, the last supported version for OS X 10.6.8 which I am purposely still using in 2021. The INPUT was set to the top level directory of my source code in the Doxyfile. I assumed it would be recursive by default or at least follow the #include'd files or my .pro file which specifies my source code inputs.
For #include it is advised to also looks a the INCLUDE_PATH settings. The .pro file is unknown to doxygen and not used. Newer versions of doxygen can probably be generated for your system as well, all depends on the compiler possibilities, but compiling the doxygen versions on this system will have to be done by yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.