Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Including moc files resulting a symbol not defined

    Mobile and Embedded
    3
    4
    2351
    Loading More Posts
    • 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.
    • L
      Luc4 last edited by

      Hi! I'm writing a plugin for Qt, starting from an already existing plugin in Qt. I'm experiencing something strange: at the end of a source file there is an inclusion of a .moc file, which is located somewhere in the Qt tree. If I remove that inclusion I get that a symbol is not defined in the library (I get an error runtime and that symbol is not in the shared lib indeed).

      Anyone can explain why that is happening and how I can avoid it? The plugin I'm talking about is the LinuxTP mouse driver.
      Thank!

      1 Reply Last reply Reply Quote 0
      • A
        andre last edited by

        Including the moc file is needed if you don't use qmake, I think. What build system do you use?

        1 Reply Last reply Reply Quote 0
        • D
          dangelog last edited by

          [quote author="Luc4" date="1305205052"]Hi! I'm writing a plugin for Qt, starting from an already existing plugin in Qt. I'm experiencing something strange: at the end of a source file there is an inclusion of a .moc file, which is located somewhere in the Qt tree. If I remove that inclusion I get that a symbol is not defined in the library (I get an error runtime and that symbol is not in the shared lib indeed).

          Anyone can explain why that is happening and how I can avoid it? The plugin I'm talking about is the LinuxTP mouse driver.
          Thank![/quote]

          It's a standard trick to fool qmake when you use Q_OBJECT classes in a .cpp file.

          Software Engineer
          KDAB (UK) Ltd., a KDAB Group company

          1 Reply Last reply Reply Quote 0
          • L
            Luc4 last edited by

            In fact I just guessed that. I solved by creating the header file.
            Thanks!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post