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. undefined symbol: typeinfo for <class>
Forum Updated to NodeBB v4.3 + New Features

undefined symbol: typeinfo for <class>

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 1.9k Views 2 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.
  • U Offline
    U Offline
    user4592357
    wrote on last edited by user4592357
    #1

    i have a header file where i declare a class derived from QObject and with Q_OBJECT macro.
    the class is an interface class (with a lot of slots), so i don't have a source file.

    when i derive a class from the interface, i get a runtime error: undefined symbol: typeinfo for <class>
    if i add a blank source file with just #include "interface.h" statement, everything works.

    i think that when i include the "interface.h" in my "class.h", then include the "class.h" in "class.cpp", moc should be fine and generate the moc file, right? so what am i missing?

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by Kent-Dorfman
      #2

      I'm pretty sure that you ARE breaking the MOC by not having a source file. The inability of Qt to define a Q_OBJECT class completely in a header file is a known limitation...at least known to me. LOL

      On a sidenote. I don't believe a QObject derived class can be a pure abstract class since QObject itself is not an interface but rather a concrete class.

      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