[Qt-interest] How to export QObjects from Qt-based DLL

Valentin Heinitz vheinitz at googlemail.com
Mon Feb 1 19:54:51 CET 2010


Hello,
I have built a dll using Qt.
This dll exports QObject derived classes.
THe build was successfull - dll and lib were created, but when I try to 
connect to my class in dll from client aplication, I  get
Linker Error: unresolved external symbol "public: static struct 
QMetaObject const Cube::staticMetaObject" 
(?staticMetaObject at Cube@@2UQMetaObject@@B) referenced in function 
"public: __thiscall qttest::qttest(class QWidget *,class QFlags<enum 
Qt::WindowType>)" 
(??0qttest@@QAE at PAVQWidget@@V?$QFlags at W4WindowType@Qt@@@@@Z)

I have exported the class using: class Q_DECL_EXPORT Cube: public 
QObject{ ...
The class is a Meyers-singleton, is it a problem?
Dependency walker shows me the symbol: struct QMetaObject const 
Cube::staticMetaObject
When I include in pro-file of my client application the header of the 
class, everything works fine. But it is not a right way.

What is wrong? Is there another macro I' forgoten?

Thank you very much!



More information about the Qt-interest-old mailing list