Results 1 to 4 of 4

Thread: Q_PROPERTY: the example doesn't work!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2008
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default Q_PROPERTY: the example doesn't work!

    I am trying to build the example from documentation, but it fails:
    Qt Code:
    1. #include <QtCore>
    2.  
    3. #include <iostream>
    4. using namespace std;
    5.  
    6. class MyClass : public QObject
    7. {
    8. Q_OBJECT
    9. Q_PROPERTY(Priority priority READ priority WRITE setPriority)
    10. Q_ENUMS(Priority)
    11.  
    12. public:
    13. MyClass(QObject *parent = 0)
    14. :QObject(parent)
    15. {
    16.  
    17. };
    18. ~MyClass()
    19. {
    20. cout << "MyClass Destructor"<<endl;
    21. };
    22.  
    23. enum Priority { High, Low, VeryHigh, VeryLow };
    24.  
    25. void setPriority(Priority priority);
    26. Priority priority() const;
    27. };
    28.  
    29.  
    30. int main(int argc, char *argv[])
    31. {
    32. QCoreApplication a(argc, argv);
    33. MyClass megaInst;
    34. return a.exec();
    35. }
    To copy to clipboard, switch view to plain text mode 

    My VS writes me:
    1>main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall MyClass::metaObject(void)const " (?metaObject@MyClass@@UBEPBUQMetaObject@@XZ)
    1>main.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall MyClass::qt_metacast(char const *)" (?qt_metacast@MyClass@@UAEPAXPBD@Z)
    1>main.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall MyClass::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MyClass@@UAEHW4Call@QMetaObject@@HPA PAX@Z)
    How can it be fixed?
    Last edited by jpn; 7th July 2009 at 08:41. Reason: missing [code] tags

Similar Threads

  1. getting MySQL to work with Qt
    By Ashish in forum Installation and Deployment
    Replies: 7
    Last Post: 19th May 2009, 08:57
  2. Qt4 : QPainter::setRedirected doesn't work
    By Ankitha Varsha in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2008, 17:52
  3. QActions don't work with menubar hidden
    By Pepe in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 01:04
  4. Change work area OS
    By pakulo in forum Qt Programming
    Replies: 15
    Last Post: 15th May 2007, 07:20

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.