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. [semi-solved] Qt5 moc error in combination with boost

[semi-solved] Qt5 moc error in combination with boost

Scheduled Pinned Locked Moved General and Desktop
12 Posts 7 Posters 13.3k 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.
  • S Offline
    S Offline
    stevenhurd
    wrote on last edited by
    #3

    Also having the same issue with Qt 5 and 1.52 version of boost. Qt 4.8 works fine. Unfortunately adding compiler guards around all the boost includes isn't really a practical solution for me since boost usage is quite extensive.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stevenhurd
      wrote on last edited by
      #4

      Thought I'd add a little info for anyone else having this issue after doing some research.

      First, this is a known MOC issue. The MOC can't expand some of the macros used in the Boost library. I believe the reason Qt 4.8 works is that a workaround for specific Boost macro definitions was added to the MOC configuration for that version.

      What you need to do to work around this issue: As stated above, use Q_MOC_RUN to comment out problematic headers. You ONLY need to use Q_MOC_RUN in files that produce a moc file (e.g. myheader.h will produce moc_myheader.cpp). You can limit the hack to just those files. So you don't need to #ifndef all usages of Boost headers in your project which limits the pain of implementing this solution quite a bit.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Avassen
        wrote on last edited by
        #5

        Today i downloaded Qt 5 sources with GIT using git://gitorious.org/qt/qt5.git link. After successfull build of it and checking that "Hello-World" apps work okey, i have encountered the same error in my project that uses "boost::function" feature every where.

        The problem looks like exactly the same as described here. Using suggested workaround (#ifndef Q_MOC_RUN ....) is realy annoying and is not acceptable in some cases for me.

        But corresponding bug report https://bugreports.qt-project.org/browse/QTBUG-29331 was closed due they say fixed it!

        My platform: Windows 7 x32, Qt v5.0.2, Boost Libs v1.51
        Should i create another bugreport?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #6

          [quote author="Avassen" date="1363949863"]Today i downloaded Qt 5 sources with GIT using git://gitorious.org/qt/qt5.git link. After successfull build of it and checking that "Hello-World" apps work okey, i have encountered the same error in my project that uses "boost::function" feature every where.

          The problem looks like exactly the same as described here. Using suggested workaround (#ifndef Q_MOC_RUN ....) is realy annoying and is not acceptable in some cases for me.

          But corresponding bug report https://bugreports.qt-project.org/browse/QTBUG-29331 was closed due they say fixed it!

          My platform: Windows 7 x32, Qt v5.0.2, Boost Libs v1.51
          Should i create another bugreport?[/quote]

          The bug report you are referencing is open and has the priority P2: Important .
          There was a discussion at the beginning, that might be a duplicate and fixed in Qt 5.0.2. However, the next comment states already the opposite. Checking the timeline makes clear that there is some possibility of cross posting within minutes/hours.

          [edited, duplicate quote removed, koahnig]

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Avassen
            wrote on last edited by
            #7

            Yes sure, it's cross-posting within minutes/hours by me))
            And after my comment in the bug-report Olivier Goffart had opened this bugreport (it was closed before due he said it seemed to be duplicate of already fixed one).

            Also I've found that very common and one of most used boost-libs "boost::thread" and "boost::mutex" causes the same conflict! Big problem that my QObjects use many classes that have boost::thread and boost::mutex members. And they cannot be "forward-defined" for workaround or "include-guarded" with Q_MOC_RUN, described above.. (((

            So very small part of people using Boost libraries in their projects can use Qt 5 lib and GUI at the moment ((...

            Please! Help needed, now my project is in deadlock while trying to migrate from Qt 4.8.4 to Qt 5.0.2 due to this collision...

            1 Reply Last reply
            0
            • C Offline
              C Offline
              charleyb
              wrote on last edited by
              #8

              +1 to @Avassen, we also are porting from 4.8.4 to 5.0.1 (soon 5.0.2), and this compile error is a show-stopper. Is there a position on addressing this?

              1 Reply Last reply
              0
              • K Offline
                K Offline
                koahnig
                wrote on last edited by
                #9

                [quote author="charleyb" date="1363968657"]+1 to @Avassen, we also are porting from 4.8.4 to 5.0.1 (soon 5.0.2), and this compile error is a show-stopper. Is there a position on addressing this?[/quote]
                You can vote on "JIRA":https://bugreports.qt-project.org for the bug report.

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  koahnig
                  wrote on last edited by
                  #10

                  [quote author="Avassen" date="1363962048"]Yes sure, it's cross-posting within minutes/hours by me))
                  And after my comment in the bug-report Olivier Goffart had opened this bugreport (it was closed before due he said it seemed to be duplicate of already fixed one).
                  [/quote]
                  No offence intended. :-)
                  It is more a summary of what might have happened and the identity of authors is not obvious.
                  Certainly it is also in my interest that boost and Qt will cooperate. Therefore it got my vote.

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    canismajor
                    wrote on last edited by
                    #11

                    The workaround does not work for me. Is there any additional news on this?

                    After upgrading to Qt 5.0.1. I am not only dealing with this issue but with hundreds of syntax and compiler errors in what used to be stable and functional code. I think the Boost error is the root cause (the Boost argument mismatch errors are reported before any of the others) but at this rate I will be better off going back to 4.8 than to try and sort it out in 5.0.1....

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tiagocc0
                      wrote on last edited by
                      #12

                      Like I have posted here: http://qt-project.org/forums/viewthread/27125/#151289
                      The issue is with the moc.exe file, in Qt 5.2 beta they have changed it from error to warning, so now you can compile.
                      You can either upgrade to 5.2 or you can just get the moc.exe file and put it in the 5.1.1 bin folder like I did, it works.

                      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