28 | | == GCC == |
| 27 | === Class inheriting from ```QObject``` should be ```moc```-ed === |
| 28 | ==== Error message ==== |
| 29 | |
| 30 | {{{ |
| 31 | >Component.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const pacpus::Component::staticMetaObject" (?staticMetaObject@Component@pacpus@@2UQMetaObject@@B) |
| 32 | >Component.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall pacpus::Component::metaObject(void)const " (?metaObject@Component@pacpus@@UBEPBUQMetaObject@@XZ) |
| 33 | >Component.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall pacpus::Component::qt_metacast(char const *)" (?qt_metacast@Component@pacpus@@UAEPAXPBD@Z) |
| 34 | >Component.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall pacpus::Component::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Component@pacpus@@UAEHW4Call@QMetaObject@@HPAPAX@Z) |
| 35 | }}} |
| 36 | |
| 37 | ==== Solution ==== |
| 38 | |
| 39 | * Check that you use ```moc``` tool on your class, i.e. file ```moc_Component.cpp``` is created and linked to the target. |
| 40 | 1. Add ```Component.h``` to CMake variable ```MOC_FILES```. |
| 41 | 2. Add ```${MOC_FILES}``` to the list of sources used by ```pacpus_add_library``` or ```pacpus_add_executable```. |