Results 1 to 5 of 5

Thread: undefined reference to vtable error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default undefined reference to vtable error

    Here is a simple Qt code I have written to study signals and slots concept :-
    Qt Code:
    1. #include<QObject>
    2. class A : public QObject{
    3. Q_OBJECT
    4. public:
    5. A(){val=0;}
    6. public slots:
    7. void changeval(int n){
    8. val=n;
    9. emit changed(val);
    10. }
    11. signals:
    12. void changed(int n);
    13. private:
    14. int val;
    15. };
    16. int main()
    17. {
    18. A l,m;
    19. }
    To copy to clipboard, switch view to plain text mode 

    I followed the following to "make" it
    1.qmake -project
    2.qmake
    3.make
    And at the last phase, I got an error as :
    Qt Code:
    1. communicate.o: In function `main':
    2. communicate.cpp:(.text+0x2d): undefined reference to `vtable for A'
    3. communicate.cpp:(.text+0x4d): undefined reference to `vtable for A'
    4. communicate.cpp:(.text+0x68): undefined reference to `vtable for A'
    5. communicate.cpp:(.text+0x8d): undefined reference to `vtable for A'
    6. collect2: ld returned 1 exit status
    7. make: *** [firstapp] Error 1
    To copy to clipboard, switch view to plain text mode 
    I don't have no idea how does this happen. Can you please help me out?
    Last edited by PaulDaviesC; 20th April 2012 at 14:15.

Similar Threads

  1. Undefined reference to vtable.
    By hakermania in forum Newbie
    Replies: 3
    Last Post: 10th September 2011, 18:10
  2. [SOLVED] Qt: Signals and slots Error: undefined reference to `vtable for
    By TheIndependentAquarius in forum Qt Programming
    Replies: 4
    Last Post: 2nd May 2011, 10:51
  3. Replies: 5
    Last Post: 7th November 2007, 14:46
  4. Error : undefined reference to `vtable for MyClass'
    By joseph in forum Qt Programming
    Replies: 23
    Last Post: 15th June 2007, 11:21
  5. Replies: 5
    Last Post: 14th February 2006, 23:43

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.