Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why QDoc don't work, it's really confusing.
Forum Update on Monday, May 27th 2025

Why QDoc don't work, it's really confusing.

Scheduled Pinned Locked Moved Unsolved General and Desktop
qdoc
26 Posts 7 Posters 6.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #10

    Hi
    Maybe try a simple sample and see ?
    https://retifrav.github.io/blog/2017/05/24/documenting-qt-project-with-qdoc/

    Stephen INFS 2 Replies Last reply
    1
    • raven-worxR raven-worx

      @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?

      Stephen INFS Offline
      Stephen INFS Offline
      Stephen INF
      wrote on last edited by
      #11

      @raven-worx
      But all output is above.

      1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        Maybe try a simple sample and see ?
        https://retifrav.github.io/blog/2017/05/24/documenting-qt-project-with-qdoc/

        Stephen INFS Offline
        Stephen INFS Offline
        Stephen INF
        wrote on last edited by
        #12

        @mrjj
        Thanks a lot,I will try it now.(Sorry for reply late...)

        1 Reply Last reply
        0
        • mrjjM mrjj

          Hi
          Maybe try a simple sample and see ?
          https://retifrav.github.io/blog/2017/05/24/documenting-qt-project-with-qdoc/

          Stephen INFS Offline
          Stephen INFS Offline
          Stephen INF
          wrote on last edited by
          #13

          @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:
          0_1556198443281_widgettest.png

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #14

            Hi
            Did you change config file to match ?
            sample uses

            headers.fileextensions = "*.hpp"
            but often its actually just "*.h"
            
            Stephen INFS 1 Reply Last reply
            0
            • mrjjM mrjj

              Hi
              Did you change config file to match ?
              sample uses

              headers.fileextensions = "*.hpp"
              but often its actually just "*.h"
              
              Stephen INFS Offline
              Stephen INFS Offline
              Stephen INF
              wrote on last edited by
              #15

              @mrjj
              Yes,I changed that.

              mrjjM 1 Reply Last reply
              0
              • Stephen INFS Stephen INF

                @mrjj
                Yes,I changed that.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #16

                @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 INFS 1 Reply Last reply
                1
                • mrjjM mrjj

                  @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 INFS Offline
                  Stephen INFS Offline
                  Stephen INF
                  wrote on last edited by
                  #17

                  @mrjj
                  Yes,I did it
                  installed LLVM6.0.1 and specify Clang location by "set LLVM_INSTALL_DIR=C:\Program Files\LLVM"

                  mrjjM 1 Reply Last reply
                  0
                  • Stephen INFS Stephen INF

                    @mrjj
                    Yes,I did it
                    installed LLVM6.0.1 and specify Clang location by "set LLVM_INSTALL_DIR=C:\Program Files\LLVM"

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #18

                    @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 INFS 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @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 INFS Offline
                      Stephen INFS Offline
                      Stephen INF
                      wrote on last edited by
                      #19

                      @mrjj
                      Well,can you try to generate C++ documentation with QDoc if you are free?

                      mrjjM 1 Reply Last reply
                      0
                      • Stephen INFS Stephen INF

                        @mrjj
                        Well,can you try to generate C++ documentation with QDoc if you are free?

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #20

                        @Stephen-INF
                        I might :)

                        1 Reply Last reply
                        0
                        • F Offline
                          F Offline
                          FrancoF
                          wrote on last edited by
                          #21

                          @mrjj
                          Hi, I have a very simila problem.

                          mrjjM 1 Reply Last reply
                          0
                          • F FrancoF

                            @mrjj
                            Hi, I have a very simila problem.

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #22

                            @FrancoF
                            Hi
                            I did try the QDoc but could not get any /fn to work either.

                            What version of Qt are you using ?

                            DevMachinesD F 2 Replies Last reply
                            0
                            • mrjjM mrjj

                              @FrancoF
                              Hi
                              I did try the QDoc but could not get any /fn to work either.

                              What version of Qt are you using ?

                              DevMachinesD Offline
                              DevMachinesD Offline
                              DevMachines
                              wrote on last edited by DevMachines
                              #23

                              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???
                              */

                              1 Reply Last reply
                              0
                              • DevMachinesD Offline
                                DevMachinesD Offline
                                DevMachines
                                wrote on last edited by
                                #24

                                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.

                                1 Reply Last reply
                                4
                                • M Offline
                                  M Offline
                                  Michael Scopchanov
                                  wrote on last edited by
                                  #25

                                  Check out this: https://stackoverflow.com/questions/52739030/why-does-q-object-break-qdoc

                                  1 Reply Last reply
                                  1
                                  • mrjjM mrjj

                                    @FrancoF
                                    Hi
                                    I did try the QDoc but could not get any /fn to work either.

                                    What version of Qt are you using ?

                                    F Offline
                                    F Offline
                                    FrancoF
                                    wrote on last edited by
                                    #26

                                    @mrjj
                                    Qt 5.12.4 (GCC 9.1.0, 64 bit) installed on MSYS.

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved