Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't compile Qt 4.8.7
Qt 6.12 LTS is out! See what's new in the release blog

Can't compile Qt 4.8.7

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 7 Posters 12.4k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #7

    This version of GCC doesn't allow the conversion from QFlags to int, so just add a static cast and you'll be good to go.

    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
    2
    • M Offline
      M Offline
      Marek
      wrote on last edited by
      #8

      Thanks for that hint.

      If anybody needs alternative I put this

      lessThan(QT_MAJOR_VERSION, 5): DEFINES +="_qt4_=1"
      

      inside .pro file and some more

      #ifdef _qt4_
      

      inside .h and .cpp files and my console app compiles with qt4 and qt5

      Best Regards
      Marek

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

        Why re-invent the wheel ? There is already everything you need provided by Qt for such version check.

        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
        0
        • T Offline
          T Offline
          themaddoctor
          wrote on last edited by
          #10

          @SGaist could you please elaborate about the cast? I tried (int) and still get an error of "invalid conversion from ‘int’ to ‘QItemSelectionModel::SelectionFlag’ [-fpermissive]"

          If I add -fpermissive to the Makefile's CXXFLAGS, I get an error that the conversion is ambiguous.

          Thank you.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            themaddoctor
            wrote on last edited by
            #11

            Is this the cast you mean? (QItemSelectionModel::SelectionFlag)

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

              No, it's static_cast.

              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
              • M Offline
                M Offline
                marcelo.banik
                wrote on last edited by
                #13

                in itemviews.cpp, I edited from:

                view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
                

                to:

                view()->selectionModel()->select(index, static_cast<QItemSelectionModel::SelectionFlags>(QItemSelectionModel::Columns & QItemSelectionModel::Deselect));
                

                and at least it compile. Using gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3)

                1 Reply Last reply
                1
                • F Offline
                  F Offline
                  FrozenTarzan
                  wrote on last edited by
                  #14

                  @SGaist , @marcelo-banik : Sorry for the late reply to this topic but your cast helped me as well to build Qt 4.8.6 with g++ 7.3.0 so thanks!

                  The problem I'm experiencing now are hundreds of warnings from within Qt. Especially stuff from the Q_OBJECT macros and meta system. One popular example is that "register" is deprecated.

                  Is there a way to get rid of warnings from within Qt but keep all the warnings for my own code? CONFIG += warn_off in the .pro file does not do the trick. It hides my own warnings as well.

                  mrjjM 1 Reply Last reply
                  0
                  • F FrozenTarzan

                    @SGaist , @marcelo-banik : Sorry for the late reply to this topic but your cast helped me as well to build Qt 4.8.6 with g++ 7.3.0 so thanks!

                    The problem I'm experiencing now are hundreds of warnings from within Qt. Especially stuff from the Q_OBJECT macros and meta system. One popular example is that "register" is deprecated.

                    Is there a way to get rid of warnings from within Qt but keep all the warnings for my own code? CONFIG += warn_off in the .pro file does not do the trick. It hides my own warnings as well.

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

                    @FrozenTarzan
                    Hi
                    Ifs the normal compiler warning, im not sure you can disable only for Qt code as
                    its actually inserted into your code so there is no difference with compiler warning.
                    However, if you code is modern and clean, i assume you could disable some of
                    the warning like register keyword as such and not hinder the useful ones for your code.

                    1 Reply Last reply
                    1
                    • F Offline
                      F Offline
                      FrozenTarzan
                      wrote on last edited by
                      #16

                      @mrjj Well, that's how I do it right now : - ) I'm usually programming warning-free but I guess that I have to disable those two for now (with g++ 7 and Qt 4.8.6 for embedded):

                      -Wno-deprecated-register -Wno-inconsistent-missing-override
                      

                      Unfortunately, I like the "override" keyword very much but it is very annoying to find the warnings from my code only and it's usually also quite bad to perform a full "warning check" manually once in a while.

                      1 Reply Last reply
                      1
                      • F Offline
                        F Offline
                        FrozenTarzan
                        wrote on last edited by
                        #17

                        Ohhh... sorry my newly setup build system utilized clang instead of g++ in QtCreator. Not sure why this is different from all other setups that I have configured in the last time. Maybe it's the preferred one by QtCreator 4.5.
                        g++ does not warn about the stuff inside Qt... so I'm "fine" ; - )

                        1 Reply Last reply
                        1

                        • Login

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