Including moc files resulting a symbol not defined



  • 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!



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



  • [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.



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.