title: Q_OBJECT linker error!
body: <p>I am receiving the following linker error when I build my application.</p>
  
  <blockquote>
    <p>HIMyClass.obj:: error: 
    unresolved external symbol "public:
    virtual struct QMetaObject const *
    __thiscall CHIMyClass::metaObject(void)const
    "
    (?metaObject@CHIMyClass@@UBEPBUQMetaObject@@XZ)
    File not found : HIMyClass.obj</p>
    
    <p>HIMyClass.obj:: error: 
    unresolved external symbol "public:
    virtual void * __thiscall
    CHIMyClass::qt_metacast(char
    const *)"
    (?qt_metacast@CHIMyClass@@UAEPAXPBD@Z) File not found : HIMyClass.obj</p>
    
    <p>HIMyClass.obj:: error: 
    unresolved external symbol "public:
    virtual int __thiscall
    CHIMyClass::qt_metacall(enum
    QMetaObject::Call,int,void * *)"
    (?qt_metacall@CHIMyClass@@UAEHW4Call@QMetaObject@@HPAPAX@Z) File not found : HIMyClass.obj</p>
  </blockquote>
  
  <p>My class declaration is like </p>
  
  <pre><code>class CHIMyClass:public QDialog
  {
     Q_OBJECT
  
     ....
  
  };
  </code></pre>
  
  <p>When I comment Q_OBJECT the linker error goes off (<em>and obviously I am not able to use signals and slots</em>). I am using Qt Creator as IDE and Qt 4.5.3. When I give <strong>Rebuild All</strong> it's definite that <strong>QMake</strong> will be called. I guess that, its the generation of moc_* files is where the problem lies. I am using Windows XP and cl as the compiler.</p>
  
  <p>What might be the reason behind this linker error?</p>