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. QTypeInfo error on GCC
Forum Updated to NodeBB v4.3 + New Features

QTypeInfo error on GCC

Scheduled Pinned Locked Moved Unsolved General and Desktop
20 Posts 6 Posters 1.4k Views 4 Watching
  • 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.
  • X Xumepoc

    Hi everyone.
    I have a problem while cross compiling a project originally created and compiled on Windows (MSVS 2019), on CentOS 8 with GCC.

    The errors I have are:

    /Qt5.9.6/5.9.6/gcc_64/include/QtCore/qtypeinfo.h:246: error: specialization of ‘template<class T> class QTypeInfo’ in different namespace [-fpermissive]
     class QTypeInfo<TYPE > \      
     ^~~~~~~~~~~~~~~~
    Qt5.9.6/5.9.6/gcc_64/include/QtCore/qtypeinfo.h:246: error: explicit specialization of ‘template<class T> class QTypeInfo’ outside its namespace must use a nested-name-specifier [-fpermissive]
     class QTypeInfo<TYPE > \
           ^~~~~~~~~~~~~~~~
    /Qt5.9.6/5.9.6/gcc_64/include/QtCore/qtypeinfo.h:254: error: invalid application of ‘sizeof’ to incomplete type ‘QPoint’
             isLarge = (sizeof(TYPE)>sizeof(void*)), \
                                   ^
    

    I what can cause the issue in GCC but not in MSVS?

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #2

    @Xumepoc
    Before going any further, somebody may ask if you cannot use a Qt version later than 5.9.6? I think that was 2018, can you not use 5.15?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      Xumepoc
      wrote on last edited by
      #3

      I can try 5.15, but would that be really the reason, for something from the Qt Core?
      I will try with 5.15 and report.

      1 Reply Last reply
      0
      • X Offline
        X Offline
        Xumepoc
        wrote on last edited by
        #4

        Well I got the same result :)

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

          Hi

          What version of GCC ?

          the "in different namespace " reminded me of something

          https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

          You say

          • while cross compiling a project

          well it's just compiling right?

          as normally cross compiling implies that you try to generate an executable on other platform.
          Like cross compiling in Linux for/to windows.

          1 Reply Last reply
          0
          • X Offline
            X Offline
            Xumepoc
            wrote on last edited by
            #6

            Hi,
            The GCC is 8.4.1.

            Yes it is a compiling :) The project was originally done on Windows and now I want to also support Linux (CentOS 8). I want to generate executable for Linux, but I can't reach that as the compile fails :)

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #7

              Then msvc allows a C++ construct but gcc8 does not. Fix your code.

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

              1 Reply Last reply
              0
              • X Offline
                X Offline
                Xumepoc
                wrote on last edited by
                #8

                Thats easy to say, but how can I know where the problem is.

                JonBJ Christian EhrlicherC 2 Replies Last reply
                0
                • X Xumepoc

                  Thats easy to say, but how can I know where the problem is.

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #9

                  @Xumepoc
                  When you get these errors, referring to something in a header file, do you not also get a line number in a file of your own code where the error is coming from? I'm not as knowledgable as @Christian-Ehrlicher, but I'm not understanding whether you get these errors just when the .h file is read or whether you get them from your own code trying to use something from the .h file?

                  1 Reply Last reply
                  0
                  • X Xumepoc

                    Thats easy to say, but how can I know where the problem is.

                    Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @Xumepoc You compile the source code so you know which file triggers the error.

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

                    1 Reply Last reply
                    0
                    • X Offline
                      X Offline
                      Xumepoc
                      wrote on last edited by
                      #11

                      @JonB I get the errors in qtypeinfo.h

                      /gcc_64/include/QtCore/qtypeinfo.h:265: error: specialization of ‘template<class T> class QTypeInfo’ in different namespace [-fpermissive]
                       class QTypeInfo<TYPE > \
                             ^~~~~~~~~~~~~~~~
                      /gcc_64/include/QtCore/qtypeinfo.h:265: error: explicit specialization of ‘template<class T> class QTypeInfo’ outside its namespace must use a nested-name-specifier [-fpermissive]
                       class QTypeInfo<TYPE > \
                             ^~~~~~~~~~~~~~~~
                      

                      and in type_traits

                      /usr/include/c++/8/type_traits:661: error: invalid use of incomplete type ‘class QPoint’
                           struct is_trivial
                                  ^~~~~~~~~~
                      

                      I don't get any errors in my code.

                      @Christian-Ehrlicher I did not compile the source code, this is 5.14.2 installed through the installer.

                      Christian EhrlicherC 1 Reply Last reply
                      0
                      • X Xumepoc

                        @JonB I get the errors in qtypeinfo.h

                        /gcc_64/include/QtCore/qtypeinfo.h:265: error: specialization of ‘template<class T> class QTypeInfo’ in different namespace [-fpermissive]
                         class QTypeInfo<TYPE > \
                               ^~~~~~~~~~~~~~~~
                        /gcc_64/include/QtCore/qtypeinfo.h:265: error: explicit specialization of ‘template<class T> class QTypeInfo’ outside its namespace must use a nested-name-specifier [-fpermissive]
                         class QTypeInfo<TYPE > \
                               ^~~~~~~~~~~~~~~~
                        

                        and in type_traits

                        /usr/include/c++/8/type_traits:661: error: invalid use of incomplete type ‘class QPoint’
                             struct is_trivial
                                    ^~~~~~~~~~
                        

                        I don't get any errors in my code.

                        @Christian-Ehrlicher I did not compile the source code, this is 5.14.2 installed through the installer.

                        Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        @Xumepoc said in QTypeInfo error on GCC:

                        @Christian-Ehrlicher I did not compile the source code, this is 5.14.2 installed through the installer.

                        I never said this.

                        You're trying to compile some code. This code triggers a warning inside the Qt headers. So simplify your code until the error is no longer triggered and the fix your code.

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

                        1 Reply Last reply
                        0
                        • X Offline
                          X Offline
                          Xumepoc
                          wrote on last edited by
                          #13

                          Yes, that would be a solution, if the project was started in Linux and complied with GCC. But as I said in my previous post, this project was originally written in Windows and compiled with MSVS where that error does not occurs. So I am not sure at what step during the development phase of the project the effect would appear if it was compiled with GCC in the first place.

                          Christian EhrlicherC 1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            Hi,

                            In that case, keep only a bare main.cpp file and gradually add back your other files until it breaks.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            1
                            • X Offline
                              X Offline
                              Xumepoc
                              wrote on last edited by
                              #15

                              Yeah, I guess that is what I will have to do....

                              1 Reply Last reply
                              0
                              • E Offline
                                E Offline
                                Ewan Green
                                wrote on last edited by Ewan Green
                                #16

                                Have you not considered using a newer version of GCC? I'm not sure on the specifics on the changes between 8 and 11 (for example), but it would be worth a shot, considering I have never had an issue in Qt triggered by a fault in GCC (which is the compiler I have Qt set to use).

                                sudo yum groupinstall "Development Tools"?

                                Ewan Green

                                1 Reply Last reply
                                0
                                • X Xumepoc

                                  Yes, that would be a solution, if the project was started in Linux and complied with GCC. But as I said in my previous post, this project was originally written in Windows and compiled with MSVS where that error does not occurs. So I am not sure at what step during the development phase of the project the effect would appear if it was compiled with GCC in the first place.

                                  Christian EhrlicherC Offline
                                  Christian EhrlicherC Offline
                                  Christian Ehrlicher
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #17

                                  @Xumepoc Again: you compile a your source files on linux. So look which source file generates the error and strip it down until it no longer occurs - daily programmers business.

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

                                  1 Reply Last reply
                                  0
                                  • X Offline
                                    X Offline
                                    Xumepoc
                                    wrote on last edited by
                                    #18

                                    @Christian-Ehrlicher I didn't expect anyone to debug my code, just if someone had encountered the same issues or have some guidance.

                                    Christian EhrlicherC JonBJ 2 Replies Last reply
                                    0
                                    • X Xumepoc

                                      @Christian-Ehrlicher I didn't expect anyone to debug my code, just if someone had encountered the same issues or have some guidance.

                                      Christian EhrlicherC Offline
                                      Christian EhrlicherC Offline
                                      Christian Ehrlicher
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #19

                                      @Xumepoc said in QTypeInfo error on GCC:

                                      or have some guidance.

                                      We have (and told you already a lot of times) - take a look from where the error comes from and fix it.

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

                                      1 Reply Last reply
                                      0
                                      • X Xumepoc

                                        @Christian-Ehrlicher I didn't expect anyone to debug my code, just if someone had encountered the same issues or have some guidance.

                                        JonBJ Offline
                                        JonBJ Offline
                                        JonB
                                        wrote on last edited by JonB
                                        #20

                                        @Xumepoc
                                        I did ask you earlier where from your own code does the #include which leads to this error appear, but never got an answer.

                                        Never mind. I believe/suggest you might find your situation is reported on this forum in Q_DECLARE_TYPEINFO and namespaces - how does it work? from 2012? I suggest you read there. The final post indicates to me there is a change which will allow your code to compile under GCC as well as MSVC:

                                        Case 2: I did forget the semicolon after the Q_DECLARE_TYPEINFO. This case now works on both compilers. Thanks!

                                        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