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. What could cause clang to error, but gcc compiles it anyway?
Forum Updated to NodeBB v4.3 + New Features

What could cause clang to error, but gcc compiles it anyway?

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 3 Posters 2.9k Views 3 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.
  • M Offline
    M Offline
    mchinand
    wrote on last edited by
    #10

    Do have the Q_OBJECT macro in your XMUI header?

    fcarneyF 1 Reply Last reply
    0
    • M mchinand

      Do have the Q_OBJECT macro in your XMUI header?

      fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #11

      @mchinand It doesn't matter if I have Q_OBJECT in there (it does). Compiling with a different Kit made all the errors disappear. I have something wrong with my Kit or Arm compiler installation. The gcc kit for the OS doesn't cause this. The Arm kit does. Strangely, a guy I work with has same exact kit and doesn't see these errors when compiling to Arm.

      @kshegunov
      I will have to research what "code model" means and why it might affect the error messages. Thanks for the tip.

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      0
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by fcarney
        #12

        Now I tested with minimal project same kit (Arm):

        #include <QCoreApplication>
        #include <QObject>
        
        class TestObj: public QObject
        {
            Q_OBJECT
        
        public:
            TestObj(QObject* parent=nullptr){
        
            }
        
        signals:
            void doexit(int code);
        };
        
        int main(int argc, char *argv[])
        {
            QCoreApplication a(argc, argv);
        
            TestObj testobj;
        
            QObject::connect(&testobj, &TestObj::doexit, qApp, &QCoreApplication::exit);
            QObject::connect(&testobj, SIGNAL(doexit()), qApp, SLOT(exit()));
        
            return a.exec();
        }
        
        #include "main.moc"
        

        No errors at all. So that leads me to believe something in the original arm project is causing this with the arm kit.

        I tried resetting the code model and it seemed to have no effect on the errors.

        C++ is a perfectly valid school of magic.

        1 Reply Last reply
        0
        • fcarneyF Offline
          fcarneyF Offline
          fcarney
          wrote on last edited by
          #13

          I found an error in my kit. The qmake was pointing to a qmake in another directory than the compiler directories. The kits were identical. However, this did not make the errors go away. Now, if I compile it never produces those errors. But if I run qmake it does a lot of thinking and then puts those errors in the log window. The errors around the actual code never go away. I am going to try updating qt creator next. Really baffled as to what I am even looking at.

          C++ is a perfectly valid school of magic.

          kshegunovK 1 Reply Last reply
          0
          • fcarneyF fcarney

            I found an error in my kit. The qmake was pointing to a qmake in another directory than the compiler directories. The kits were identical. However, this did not make the errors go away. Now, if I compile it never produces those errors. But if I run qmake it does a lot of thinking and then puts those errors in the log window. The errors around the actual code never go away. I am going to try updating qt creator next. Really baffled as to what I am even looking at.

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by kshegunov
            #14

            @fcarney said in What could cause clang to error, but gcc compiles it anyway?:

            Really baffled as to what I am even looking at.

            Open the documentation for Creator and check how to disable the clang code model (I think it was disabling the plugin somewhere in the menus). Report back whether the 'errors' went away.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • fcarneyF Offline
              fcarneyF Offline
              fcarney
              wrote on last edited by
              #15

              @kshegunov said in What could cause clang to error, but gcc compiles it anyway?:

              Report back whether the 'errors' went away.

              The errors are no more. qmake and rebuild.

              C++ is a perfectly valid school of magic.

              kshegunovK 1 Reply Last reply
              0
              • fcarneyF fcarney

                @kshegunov said in What could cause clang to error, but gcc compiles it anyway?:

                Report back whether the 'errors' went away.

                The errors are no more. qmake and rebuild.

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by kshegunov
                #16

                If you still want to use it, tweak the flags to suit your need after re-enabling:
                https://doc.qt.io/qtcreator/creator-clang-codemodel.html

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • fcarneyF Offline
                  fcarneyF Offline
                  fcarney
                  wrote on last edited by
                  #17

                  How can clang produce errors for one kit on the project, but not produce errors for the same project on another kit? Same exact code. Same exact clang settings. This sounds like to me some temporary file is not getting cleared.

                  C++ is a perfectly valid school of magic.

                  kshegunovK 1 Reply Last reply
                  0
                  • fcarneyF fcarney

                    How can clang produce errors for one kit on the project, but not produce errors for the same project on another kit? Same exact code. Same exact clang settings. This sounds like to me some temporary file is not getting cleared.

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by
                    #18

                    Dunno. It shouldn't, but I don't use it because it is fat.

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply
                    1
                    • fcarneyF Offline
                      fcarneyF Offline
                      fcarney
                      wrote on last edited by
                      #19

                      I am gonna say this is solved. I am tired of wasting time on this. Thanks for your help everyone.
                      If I figure this out later I will post something here. I am going to be reevaluating my arm compiler installation later. Maybe that will find something.

                      C++ is a perfectly valid school of magic.

                      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