Results 1 to 5 of 5

Thread: Q_OBJECT macro and link errors

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Q_OBJECT macro and link errors

    Hello.

    When I want to use the Q_OBJECT macro in one of my classes, I have link errors saying "unresolved external symbol" :

    main.obj : error LNK2001: symbole externe non résolu "public: virtual struct QMetaObject const * __cdecl Recepteur::metaObject(void)const " (?metaObject@Recepteur@@UBAPBUQMetaObject@@XZ)
    main.obj : error LNK2001: symbole externe non résolu "public: virtual void * __cdecl Recepteur::qt_metacast(char const *)" (?qt_metacast@Recepteur@@UAAPAXPBD@Z)
    main.obj : error LNK2001: symbole externe non résolu "public: virtual int __cdecl Recepteur::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Recepteur@@UAAHW4Call@QMetaObject@@H PAPAX@Z)
    There's no error when I compile the same code without the Q_OBJECT macro.

    Here's the code of my very simple class :

    Qt Code:
    1. class Recepteur : public QObject
    2. {
    3. Q_OBJECT
    4.  
    5. public :
    6.  
    7. Recepteur(){};
    8.  
    9. public slots:
    10. void ButtonPushedReceived()
    11. {
    12. printf("Le bouton a été poussé");
    13. }
    14. };
    To copy to clipboard, switch view to plain text mode 

    Thank you for your answers.

    Patrick Schevenels
    Last edited by jpn; 21st March 2008 at 13:19. Reason: missing [code] and [quote] tags

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.