= FAQ ^([#fnfaq 1])^ -- common compilation errors = == MSVC == === ```ComponentBase``` should be inherited AFTER ```QObject``` === ==== Error message ==== {{{ >moc_Component.cpp(63): error C2039: 'staticMetaObject' : is not a member of 'pacpus::ComponentBase' > ComponentBase.h(60) : see declaration of 'pacpus::ComponentBase' >moc_Component.cpp(80): error C2039: 'qt_metacast' : is not a member of 'pacpus::ComponentBase' > ComponentBase.h(60) : see declaration of 'pacpus::ComponentBase' >moc_Component.cpp(85): error C2039: 'qt_metacall' : is not a member of 'pacpus::ComponentBase' > ComponentBase.h(60) : see declaration of 'pacpus::ComponentBase' }}} ==== Solution ==== Your class declaration should look like: {{{ class Component : QObject , ComponentBase { }; }}} === Class inheriting from ```QObject``` should be ```moc```-ed === ==== Error message ==== {{{ >Component.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const pacpus::Component::staticMetaObject" (?staticMetaObject@Component@pacpus@@2UQMetaObject@@B) >Component.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall pacpus::Component::metaObject(void)const " (?metaObject@Component@pacpus@@UBEPBUQMetaObject@@XZ) >Component.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall pacpus::Component::qt_metacast(char const *)" (?qt_metacast@Component@pacpus@@UAEPAXPBD@Z) >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) }}} ==== Solution ==== * Check that you use ```moc``` tool on your class, i.e. file ```moc_Component.cpp``` is created and linked to the target. 1. Add ```Component.h``` to CMake variable ```MOC_FILES```. 2. Add ```${MOC_FILES}``` to the list of sources used by ```pacpus_add_library``` or ```pacpus_add_executable```. == Varia == [=#fnfaq] FAQ -- Frequently Asked Questions