Why QDoc don't work, it's really confusing.
-
@jsulm
Thank you for you help,here is my test code/*! \fn MainWindow::MainWindow(QWidget *parent) Constructor Mainwindow */ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); }
But I think the issue might be related to "error: use of undeclared identifier 'MainWindow' ".
-
@Stephen-INF This error comes from CLang code model. I guess it does not understand this QDoc syntax.
-
@raven-worx
Hi,I really want to try Qdoc,and I have spent many hours,still don't know where I am doing wrong.If QDoc is usable for you,can you give me an example,thanks a lot. -
@Stephen-INF
in the end we are talking about a CLANG warning. This shouldn't influence QDoc though.
QDoc should output something meaningful in the meantime or? -
Hi
Maybe try a simple sample and see ?
https://retifrav.github.io/blog/2017/05/24/documenting-qt-project-with-qdoc/ -
@raven-worx
But all output is above. -
@mrjj
I tried,QDoc works well with qml ,but C++ Class still do not works.
I found generate documentation for qml only need one "source" file,but C++ class need both "source" and "header" file.
I guess there might be something wrong with header file ?So QDoc can't analyse source file as normal.New C++ class "WidgetTest" added in project privided in the link.
header file:
#include <QWidget> class WidgetTest : public QWidget { Q_OBJECT public: explicit WidgetTest(QWidget *parent = nullptr); };
source file without "\fn":
/*! \class WidgetTest \brief WidgetTest for ui interface. \inmodule module0 */ /*! WidgetTest::WidgetTest(QWidget *parent) constructor WidgetTest */ WidgetTest::WidgetTest(QWidget *parent) : QWidget(parent) { }
output:
warning: Cannot tie this documentation to anything [qdoc found a /*! ... */ comment, but there was no topic command (e.g., '\fn', '\page') in the comment and no function definition following the comment.]
source file with "\fn":
/*! \class WidgetTest \brief WidgetTest for ui interface. \inmodule module0 */ /*! \fn WidgetTest::WidgetTest(QWidget *parent) constructor WidgetTest */ WidgetTest::WidgetTest(QWidget *parent) : QWidget(parent) { }
output:
warning: clang found diagnostics parsing \fn WidgetTest::WidgetTest(QWidget *parent) error: use of undeclared identifier 'WidgetTest' error: unknown type name 'QWidget'
widgettest.html is same:
-
Hi
Did you change config file to match ?
sample usesheaders.fileextensions = "*.hpp" but often its actually just "*.h"
-
@Stephen-INF
hmm odd. then
it seems clang have issue parsing the header
( QDoc uses clang from Qt 5.11)You did follow step to install it ?
https://doc.qt.io/qt-5/qdoc-guide-clang.html -
@Stephen-INF
That seems pretty ok.
However, since the other part of generation seems to work, then
it must be something with clang and /fn
But I cant guess what not right. -
@Stephen-INF
I might :) -
Re: [Why QDoc don't work](it's really confusing.)
I have the same issue with Qt5.12.0 on Windows. Does anyone have the solution for this?
Some notes - the enumerator was processed without problems:class MyClass
{
public:
enum Type
{
}
void foo();
}/*!
\enum MyClass::Type - parsed without errors
\value …
*//*!
\fn void MyClass::foo() - error: use of undeclared identifier 'MyClass' why???
*/ -
To fix the error, you need to switch to VS2015 Build Tool. For VS2017 I could not get the compiler to work. But for 2015 everything works as expected.