Changes between Version 2 and Version 3 of FAQ_compilation


Ignore:
Timestamp:
Oct 11, 2013, 3:21:56 PM (11 years ago)
Author:
Marek Kurdej
Comment:

Added: Moc'ing QObject-based classes

Legend:

Unmodified
Added
Removed
Modified
  • FAQ_compilation

    v2 v3  
    44
    55=== ```ComponentBase``` should be inherited AFTER ```QObject``` ===
    6 
    76==== Error message ====
    87{{{
     
    2625}}}
    2726
    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.
     401. Add ```Component.h``` to CMake variable ```MOC_FILES```.
     412. Add ```${MOC_FILES}``` to the list of sources used by ```pacpus_add_library``` or ```pacpus_add_executable```.
    2942
    3043== Varia ==