Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  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 Qt Creator and other tools
cmakepluginmsvc2013
2 Posts 1 Posters 1.4k 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 22 May 2015, 13:34 last edited by
    #1

    Problem:
    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. 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 why moc can't parse it. Even more confusing is, that if I enable CMAKE_AUTOMOC, then suddenly the problem goes away.

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

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jakob
      wrote on 22 May 2015, 13:38 last edited by
      #2

      Forgot to mention: this is with qt 5.4.0

      1 Reply Last reply
      0

      1/2

      22 May 2015, 13:34

      • Login

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