Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-70896

Qt headers break qdoc on Linux

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.11.2
    • Build tools: qdoc
    • None
    • Ubuntu 64-bit

      GCC 7

    • Linux/X11

    Description

      qdoc seems to break whenever I start using Qt classes on Linux. I am using Ubuntu 64-bit. On Windows 10 64-bit with the same version of Qt it works fine.

      Minimum example:

      MyClass.h

      #pragma once
      #include <QString>
      struct MyClass { QString foo() { return "Hello World"; } };

      MyClass.qdoc

      /*!
      \module MyModule
      */
      
      /*!
      \class MyClass
      \inmodule MyModule
      \brief Short desc.
      */
      
      /*!
      \fn QString MyClass::foo()
      Returns "Hello world".
      */
      

      MyClass.module

      #pragma once
      #include "MyClass.h"

      MyClass.qdocconf

      outputdir = html
      headerdirs = .
      sourcedirs = .
      headers.fileextensions += *.h
      sources.fileextensions += *.qdoc
      moduleheader = MyClass.module
      includepaths = . $QTDIR/include $QTDIR/include/QtCore
      

      Now this produces following output:

      qdoc MyClass.qdocconf [MyClass]

      /home/michael/Qt/5.11.2/gcc_64/bin/qdoc /home/michael/qdoctest/MyClass.qdocconf -outputdir /home/michael/build-MyClass-Desktop_Qt_5_11_2_GCC_64bit-Debug/qtc_Desktop_Qt_5_11_2_GCC_64bit_Debug/MyClass.6f532a49/qdoc_html

      /home/michael/qdoctest/MyClass.qdoc:5: (qdoc) warning: Cannot find 'MyClass' specified with '\class' in any header file

      /home/michael/qdoctest/MyClass.qdoc:11: (qdoc) warning: clang found diagnostics parsing \fn QString MyClass::foo()
          error: use of undeclared identifier 'MyClass'

       

      What happens when I remove the includepaths to Qt includes? The following:

      • QString include will be ignored (no warning, nothing)
      • Any usage of QString will be replaced with `int`

      Well that is not exactly what I would expect but here you go. Anyway, without those inlcude paths and following change to the header:

      MyClass.h

      #pragma once
      #include <string>
      struct MyClass { std::string foo() { return "Hello World"; } };

      Followed of course by the likewise change to the qdoc file it works fine.

       

      Therefore there must be something in the Qt headers that breaks qdoc on Linux when using GCC 7 and its (system) headers. Or maybe there needs to be some kind of define or environment variable set? This is going on since Qt 5.11 series.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            docinfrastructure Documentation Infrastructure Team
            resurr3ction Michael Vlach
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes