I'm currently porting my application from Qt4.8 to Qt5.6
Some code that use to compile and link now stopped linking properly.
I narrowed it down to a call to qRegisterMetaType<MyClass*>
where MyClass* inherits from QObject.
MyClass is defined and implemented in a separate plugin. So in this context, I'm simply including "MyClass.h" in which I have a Q_DECLARE_METATYPE(MyClass*)
It use to work perfectly with Qt4.8 but with Qt5.6 but now it fails to link:
error LNK2001: unresolved external symbol "public: static struct QMetaObject const MyClass::staticMetaObject"
What has changed with Qt5? Am I doing it wrong?
Better late than never, the answer is indeed to use the macro mentioned in the comments above. It is more or less explained in the manual for
int qRegisterMetaType(const char *typeName)