[[PageOutline(1-10,Contents,inline)]] = 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```. === ```addInputs()``` / ```addOutputs``` can be used only in a class derived from ```QObject``` === ==== Error message ==== {{{ >C:\Program Files (x86)\Pacpus\include\Pacpus/kernel/InputOutputInterface.h(21): error C2664: 'pacpus::InputInterfaceBase::InputInterfaceBase(QString,pacpus::ComponentBase *,QObject *)' : cannot convert parameter 3 from 'pacpus::LMOComponent *' to 'QObject *' > Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast > C:\Program Files (x86)\Pacpus\include\Pacpus/kernel/InputOutputInterface.h(18) : while compiling class template member function 'pacpus::InputInterface::InputInterface(QString,C *,void (__thiscall pacpus::Component::* )(const T &))' > with > [ > T=pacpus::___, > C=pacpus::Component > ] > C:\Program Files (x86)\Pacpus\include\Pacpus/kernel/ComponentBase.h(150) : see reference to class template instantiation 'pacpus::InputInterface' being compiled > with > [ > T=pacpus::___, > C=pacpus::Component > ] > ..\..\..\cityvip-2.0-beta1\src\LMOComponent\Component.cpp(44) : see reference to function template instantiation 'void pacpus::ComponentBase::addInput(const char *,Function)' being compiled > with > [ > Function=void (__thiscall pacpus::Component::* )(const pacpus::___ &) > ] }}} ==== Solution ==== Inherit your class from ```QObject```. == Varia == [=#fnfaq] FAQ -- Frequently Asked Questions