1

I'm trying to learn Doxygen.

I almost have all warnings and errors found. However there are two that I cannot figure out.

My code is something like

namespace SE{

//! Description etc
template <typename _T>
class MyClass{

public:
       MyClass(int, int);

private:
       std::vector<std::vector<_T>> data;
       double X;      //< Description
}

//! Description etc
template <typename T>
MyClass<T>::MyClass(int rows, int cols){
       data.resize(rows, std::vector<T>(cols));
}

} /* End of namespace SE*/

When I try to process it with doxygen I am getting a warning:

warning: Member resize(rows, std::vector< T >(cols)) (function) of namespace SE is not documented

It looks like it thinks that this is my own function. How do I tell Doxygen it is from std::vector?

I also have another member function defined outside of the function body which has a for loop and I am getting

warning: Member for(auto i=0;i< n;++i) (function) of namespace SE is not documented.

I also had another function where I had a member variable, X, and when I was writing the function outside the class definition body, it said that X was not documented.

//! Description etc.
void MyClass::myfunc(){
      X=2.0;       // Doxygen complained here
}

I was able to "fix" it by doing

void MyClass::myfunc(){
      MyClass::X=2.0;       // Doxygen warning suppressed
}

or

void MyClass::myfunc(){
      this->X=2.0;       //  Doxygen warning suppressed
}

Should I have needed to do this?

EDIT: I also have the issue that in the documentation I have:

 Functions
        SE::for (auto i=0;i< n;++i)

data    SE::resize (n, std::vector< T >(m))

in the generated documentation

TCD
  • 151
  • 1
  • 7
  • Doxygen is not a C++ compiler. Only a C++ compiler can fully understand C++ code. Especially when hairy templates get involved doxygen will occasionally parse something incorrectly. It is what it is. The only real answer here is: "deal with it". – Sam Varshavchik Feb 22 '20 at 16:54
  • ok. Thanks for the response. I am just trying it for the first time. I had (mistakenly?) assumed that it would be better, and possible, to try to have it so that there were no warnings/errors. – TCD Feb 22 '20 at 16:57
  • Which version of doxygen are you using? Can you make a small, complete, example showing the problem including the difference between the default doxygen configuration file and the configuration file you used (vor versions >= 1.8.15: `doxygen -x Doxyfile`). – albert Feb 22 '20 at 17:06
  • @albert I have version 1.8.11 . I am using a fresh Doxyfile. I had made some minor changes but I just regenerated it there with "doxygen -g" just in case there was an issue. I will try to strip it down to a small version now! – TCD Feb 22 '20 at 17:25
  • 1
    1.8.11 is quite old (December 2015), the current version is 1.8.17. By head quite a few changes have been made also in this respect, so try this version (or the master version). – albert Feb 22 '20 at 17:28
  • Try this suggestion from another post. https://stackoverflow.com/questions/39017317/doxypy-member-variable-of-namespace-is-not-documented – Threshold19 Feb 22 '20 at 17:29
  • @Threshold19 The suggestion in the post you mentioned was about the comment forms in Python, what is your suggestion for c++? – albert Feb 22 '20 at 17:38
  • @albert. I managed to install the newest version from source (along with some other requirements that it was looking for such as an updated textlive and epstopdf) and now it seems to work! – TCD Feb 22 '20 at 19:02

0 Answers0