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. [SOLVED] missing binary operator before token "(" - QT Creator
Forum Update on Monday, May 27th 2025

[SOLVED] missing binary operator before token "(" - QT Creator

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 4.1k 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.
  • J Offline
    J Offline
    jellyv
    wrote on last edited by jellyv
    #1

    I'm getting this error in all ui_xxx.h header files( for instance, ui_editwindow.h ) on every line containing #if QT_CONFIG(tooltip).
    I'm also getting the same error in all xxx.cpp files (for instance, editwindow.cpp) on the line where I include the relevant ui_xxx.h header file (for instance, #include ui_editwindow.h in editwindow.cpp)

    In all ui_xxx.h files, the errors are inside of void retranslateUi, so probably it has something to do with translation error (not sure tho).
    The project was initially written in older version of QT(4.x or even older) and now I'm using 5.6.0.(the only version I can use for some reasons..)

    This is my code:
    y.png

    I've seen people with same error saying that it was caused by the name of the header file, or some small mistake inside of the header file. But, in my case, the error is inside ui_editwindow.h, which is automatically built by by QT Creator, and isn't supposed to be edited directly. So, I suppose it's QT Creator bug (as opposed to developer mistake)

    Any ideas about the problem?

    aha_1980A 1 Reply Last reply
    0
    • J jellyv

      Hi @aha_1980,
      I'm on windows 10 pro (64 bit), and am using QT Creator 5.6.0 (downloaded from the following link: https://download.qt.io/archive/qt/5.6/5.6.0/ . I downloaded qt-opensource-windows-x86-mingw492-5.6.0.exe, which i guess comes with in-built mingw compiler).
      I'm getting the errors while building/compiling the code.

      About the last three questions:

      • did the project compile successfully on the latest Qt 4.8.x release?
        The code was initially written over a decade ago and many people have worked on it since, but I know that it ran successfully on some QT 5.x version.

      • did you already change something to port to Qt 5?
        I haven't made any changes to the code yet (If that's what you're asking)

      • Have you made sure that all these generated headers are fresh generated by the Qt5 uic?
        I do not think so, could you tell me how can I ensure that QT5 does that?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by aha_1980
      #4

      @jellyv said in missing binary operator before token "(" - QT Creator:

      The code was initially written over a decade ago and many people have worked on it since, but I know that it ran successfully on some QT 5.x version.

      Please find out which Qt 5.x version that was exactly. It may have been a newer version than 5.6, which could leave unsupported properties in the ui file.

      Have you made sure that all these generated headers are fresh generated by the Qt5 uic?

      I do not think so, could you tell me how can I ensure that QT5 does that?

      Close Qt Creator, delete the build folder(s), the .pro.user, and anything related to Makefile.*, ui_*.h etc. which is surely no source or header file.

      Then open Creator, assign the Qt 5.6 kit to your project and retry.

      If that does not help: can you upload the editwindow.ui file?

      QT Creator 5.6.0

      That is the Qt version, not the Qt Creator version, which you can find on Help > About Qt Creator.

      Regards

      Qt has to stay free or it will die.

      J 1 Reply Last reply
      2
      • J jellyv

        I'm getting this error in all ui_xxx.h header files( for instance, ui_editwindow.h ) on every line containing #if QT_CONFIG(tooltip).
        I'm also getting the same error in all xxx.cpp files (for instance, editwindow.cpp) on the line where I include the relevant ui_xxx.h header file (for instance, #include ui_editwindow.h in editwindow.cpp)

        In all ui_xxx.h files, the errors are inside of void retranslateUi, so probably it has something to do with translation error (not sure tho).
        The project was initially written in older version of QT(4.x or even older) and now I'm using 5.6.0.(the only version I can use for some reasons..)

        This is my code:
        y.png

        I've seen people with same error saying that it was caused by the name of the header file, or some small mistake inside of the header file. But, in my case, the error is inside ui_editwindow.h, which is automatically built by by QT Creator, and isn't supposed to be edited directly. So, I suppose it's QT Creator bug (as opposed to developer mistake)

        Any ideas about the problem?

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi @jellyv,

        The basic questions are:

        • which platform are you on?
        • which Qt Creator version, Qt version and compiler are you using?
        • do you get these errors while compiling or while editing/reading code?

        Now the more advanced ones:

        • did the project compile successfully on the latest Qt 4.8.x release?
        • did you already change something to port to Qt 5?
        • Have you made sure that all these generated headers are fresh generated by the Qt5 uic?

        Regards

        Qt has to stay free or it will die.

        J 1 Reply Last reply
        0
        • aha_1980A aha_1980

          Hi @jellyv,

          The basic questions are:

          • which platform are you on?
          • which Qt Creator version, Qt version and compiler are you using?
          • do you get these errors while compiling or while editing/reading code?

          Now the more advanced ones:

          • did the project compile successfully on the latest Qt 4.8.x release?
          • did you already change something to port to Qt 5?
          • Have you made sure that all these generated headers are fresh generated by the Qt5 uic?

          Regards

          J Offline
          J Offline
          jellyv
          wrote on last edited by
          #3

          Hi @aha_1980,
          I'm on windows 10 pro (64 bit), and am using QT Creator 5.6.0 (downloaded from the following link: https://download.qt.io/archive/qt/5.6/5.6.0/ . I downloaded qt-opensource-windows-x86-mingw492-5.6.0.exe, which i guess comes with in-built mingw compiler).
          I'm getting the errors while building/compiling the code.

          About the last three questions:

          • did the project compile successfully on the latest Qt 4.8.x release?
            The code was initially written over a decade ago and many people have worked on it since, but I know that it ran successfully on some QT 5.x version.

          • did you already change something to port to Qt 5?
            I haven't made any changes to the code yet (If that's what you're asking)

          • Have you made sure that all these generated headers are fresh generated by the Qt5 uic?
            I do not think so, could you tell me how can I ensure that QT5 does that?

          aha_1980A 1 Reply Last reply
          0
          • J jellyv

            Hi @aha_1980,
            I'm on windows 10 pro (64 bit), and am using QT Creator 5.6.0 (downloaded from the following link: https://download.qt.io/archive/qt/5.6/5.6.0/ . I downloaded qt-opensource-windows-x86-mingw492-5.6.0.exe, which i guess comes with in-built mingw compiler).
            I'm getting the errors while building/compiling the code.

            About the last three questions:

            • did the project compile successfully on the latest Qt 4.8.x release?
              The code was initially written over a decade ago and many people have worked on it since, but I know that it ran successfully on some QT 5.x version.

            • did you already change something to port to Qt 5?
              I haven't made any changes to the code yet (If that's what you're asking)

            • Have you made sure that all these generated headers are fresh generated by the Qt5 uic?
              I do not think so, could you tell me how can I ensure that QT5 does that?

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by aha_1980
            #4

            @jellyv said in missing binary operator before token "(" - QT Creator:

            The code was initially written over a decade ago and many people have worked on it since, but I know that it ran successfully on some QT 5.x version.

            Please find out which Qt 5.x version that was exactly. It may have been a newer version than 5.6, which could leave unsupported properties in the ui file.

            Have you made sure that all these generated headers are fresh generated by the Qt5 uic?

            I do not think so, could you tell me how can I ensure that QT5 does that?

            Close Qt Creator, delete the build folder(s), the .pro.user, and anything related to Makefile.*, ui_*.h etc. which is surely no source or header file.

            Then open Creator, assign the Qt 5.6 kit to your project and retry.

            If that does not help: can you upload the editwindow.ui file?

            QT Creator 5.6.0

            That is the Qt version, not the Qt Creator version, which you can find on Help > About Qt Creator.

            Regards

            Qt has to stay free or it will die.

            J 1 Reply Last reply
            2
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #5

              This is a long shot but I'll go for it: in editwindow.h did you forget the ; at the end of the class definition?

              class EditWindow{
              
              }
              ; // This guy!
              

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              J 1 Reply Last reply
              0
              • VRoninV VRonin

                This is a long shot but I'll go for it: in editwindow.h did you forget the ; at the end of the class definition?

                class EditWindow{
                
                }
                ; // This guy!
                
                J Offline
                J Offline
                jellyv
                wrote on last edited by
                #6

                @VRonin

                namespace Ui {
                class EditWindow;
                }
                

                This is what class definition looks like. the semicolon ( ; ) doesn't have to be after closing bracket ( } ), does it?

                1 Reply Last reply
                0
                • aha_1980A aha_1980

                  @jellyv said in missing binary operator before token "(" - QT Creator:

                  The code was initially written over a decade ago and many people have worked on it since, but I know that it ran successfully on some QT 5.x version.

                  Please find out which Qt 5.x version that was exactly. It may have been a newer version than 5.6, which could leave unsupported properties in the ui file.

                  Have you made sure that all these generated headers are fresh generated by the Qt5 uic?

                  I do not think so, could you tell me how can I ensure that QT5 does that?

                  Close Qt Creator, delete the build folder(s), the .pro.user, and anything related to Makefile.*, ui_*.h etc. which is surely no source or header file.

                  Then open Creator, assign the Qt 5.6 kit to your project and retry.

                  If that does not help: can you upload the editwindow.ui file?

                  QT Creator 5.6.0

                  That is the Qt version, not the Qt Creator version, which you can find on Help > About Qt Creator.

                  Regards

                  J Offline
                  J Offline
                  jellyv
                  wrote on last edited by
                  #7

                  @aha_1980
                  you were right: The generated headers (ui_*.h) were not generated by the QT5 uic. your steps fixed the problem. Amazing, thank you.

                  For others who have the same issue in future:
                  After I deleted the files listed by @aha_1980, I opened qt and chose Rebuild All, which resulted in some other error.
                  I tried the whole thing again(deleted the listed files from original project), and then tried to Clean All, then Build All, and it worked that time. This is because these two processes function differently.

                  JboKH.png

                  Image credits: Shivprasad Koirala

                  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 Extensions
                  • Unsolved