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. Qt 6 incompatible with Clang?
QtWS25 Last Chance

Qt 6 incompatible with Clang?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 599 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.
  • W Offline
    W Offline
    whatabout
    wrote on 31 Jan 2024, 16:36 last edited by
    #1

    Compiling with Clang 14, which is a C++20 compiler, I am getting strange errors, below.
    It there a flag I need to set to change Clang's compatibility?

    In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/QMainWindow:1:
    In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qmainwindow.h:7:
    In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qtwidgetsglobal.h:7:
    In file included from /usr/include/x86_64-linux-gnu/qt6/QtGui/qtguiglobal.h:7:
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:106:6: error: "Qt requires a C++17 compiler"
    #    error "Qt requires a C++17 compiler"
         ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:491:11: warning: inline variables are a C++17 extension [-Wc++17-extensions]
    constexpr inline Deprecated_t Deprecated = {};
              ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:1009:43: error: no template named 'is_arithmetic_v' in namespace 'std'; did you mean 'is_arithmetic'?
             typename = std::enable_if_t<std::is_arithmetic_v<T> && std::is_arithmetic_v<U> &&
                                         ~~~~~^~~~~~~~~~~~~~~
                                              is_arithmetic
    /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:585:12: note: 'is_arithmetic' declared here
        struct is_arithmetic
    
    
    C 1 Reply Last reply 31 Jan 2024, 16:51
    0
    • C Christian Ehrlicher
      31 Jan 2024, 18:41

      @whatabout Then make sure to enable c++17 as I already wrote.

      W Offline
      W Offline
      whatabout
      wrote on 31 Jan 2024, 18:51 last edited by
      #5

      @Christian-Ehrlicher
      Yes, it turns out the fix is simple:

      clang -std=c++17

      1 Reply Last reply
      0
      • W whatabout
        31 Jan 2024, 16:36

        Compiling with Clang 14, which is a C++20 compiler, I am getting strange errors, below.
        It there a flag I need to set to change Clang's compatibility?

        In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/QMainWindow:1:
        In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qmainwindow.h:7:
        In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qtwidgetsglobal.h:7:
        In file included from /usr/include/x86_64-linux-gnu/qt6/QtGui/qtguiglobal.h:7:
        /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:106:6: error: "Qt requires a C++17 compiler"
        #    error "Qt requires a C++17 compiler"
             ^
        /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:491:11: warning: inline variables are a C++17 extension [-Wc++17-extensions]
        constexpr inline Deprecated_t Deprecated = {};
                  ^
        /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:1009:43: error: no template named 'is_arithmetic_v' in namespace 'std'; did you mean 'is_arithmetic'?
                 typename = std::enable_if_t<std::is_arithmetic_v<T> && std::is_arithmetic_v<U> &&
                                             ~~~~~^~~~~~~~~~~~~~~
                                                  is_arithmetic
        /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:585:12: note: 'is_arithmetic' declared here
            struct is_arithmetic
        
        
        C Online
        C Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on 31 Jan 2024, 16:51 last edited by
        #2

        Please show your pro-file / CMakeLists.txt and make sure you've enabled c++17 support.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        W 1 Reply Last reply 31 Jan 2024, 17:51
        1
        • C Christian Ehrlicher
          31 Jan 2024, 16:51

          Please show your pro-file / CMakeLists.txt and make sure you've enabled c++17 support.

          W Offline
          W Offline
          whatabout
          wrote on 31 Jan 2024, 17:51 last edited by whatabout
          #3

          @Christian-Ehrlicher I'm not using either a .pro file or a cmake file. I'm just using a regular Makefile and I'm not specifying any particular C++ compatibility. In my situation I can't use either qmake or cmake. So for instance, I am running moc myself.

          C 1 Reply Last reply 31 Jan 2024, 18:41
          0
          • W whatabout
            31 Jan 2024, 17:51

            @Christian-Ehrlicher I'm not using either a .pro file or a cmake file. I'm just using a regular Makefile and I'm not specifying any particular C++ compatibility. In my situation I can't use either qmake or cmake. So for instance, I am running moc myself.

            C Online
            C Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 31 Jan 2024, 18:41 last edited by
            #4

            @whatabout Then make sure to enable c++17 as I already wrote.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            W 1 Reply Last reply 31 Jan 2024, 18:51
            1
            • C Christian Ehrlicher
              31 Jan 2024, 18:41

              @whatabout Then make sure to enable c++17 as I already wrote.

              W Offline
              W Offline
              whatabout
              wrote on 31 Jan 2024, 18:51 last edited by
              #5

              @Christian-Ehrlicher
              Yes, it turns out the fix is simple:

              clang -std=c++17

              1 Reply Last reply
              0
              • W whatabout has marked this topic as solved on 31 Jan 2024, 18:51

              4/5

              31 Jan 2024, 18:41

              • Login

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