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. MOC produces parse error with MSVC/CMake/qt5_wrap_cpp when handling a plugin interface

MOC produces parse error with MSVC/CMake/qt5_wrap_cpp when handling a plugin interface

Scheduled Pinned Locked Moved General and Desktop
plugincmakemsvc2013bug
1 Posts 1 Posters 2.2k 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
    Jakob
    wrote on 25 May 2015, 12:37 last edited by
    #1

    My problem using qt 5.4.0/MSVC 2013/cmake 3.2.2 (but also with 3.1.3):

    I have a build infrastructure based on CMake, and try to build a plugin is MSVC2013. In the CMake file I write qt5_wrap_cpp(SOME_NAME ${PLUGIN_HEADER}) where the ${PLUGIN_HEADER} refers to the header file for the plugin, which declares the plugin interface, including the Q_OBJECT, Q_PLUGIN_METADATA and Q_INTERFACES macros. If it matters: the plugin interface itself is inside a namespace, the interface it implements is in a different namespace.

    When building, and the build system tries to create the moc_-file corresponding to the ${PLUGIN_HEADER}, it complains about: 'Parse error at "IID"'. It also tells the line, which is the line where the Q_PLUGIN_METADATA macro is used.

    So, it is pretty obvious what the complaint is about, namely the 'IID' tag I have to pass to that macro, but it is not clear to me why moc can't parse it. Even more confusing is: if I enable CMAKE_AUTOMOC, then suddenly the problem goes away.

    Preferably I'd like to build without the CMAKE_AUTOMOC, so what am I missing here? Why does the direct approach not work? (btw: qt5_generate_moc fails in the same way). My feeling is that my code is correct, because it does work with automoccing. Have I stumbled upon some bug?

    1 Reply Last reply
    0

    1/1

    25 May 2015, 12:37

    • Login

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