Results 1 to 4 of 4

Thread: Undefined reference to vtable.

  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Unhappy Undefined reference to vtable.

    I know, YES, I know, I've searched the forum and the google but I still don't know what I'm doing wrong
    I am trying to use QNetWork for a network operation, as somebody suggested (http://www.qtcentre.org/threads/4451...705#post202705)

    As you may know, static functions do not allow calling 'this', so I am trying via a static function available from all the piece of code I have to make QNetwork work.

    My problem is that through this static function I am trying to call a non-static function so as to be able to call 'connect' (which needs 'this' which need non-static function -_-)
    So, this is how I call my non-static function:
    Qt Code:
    1. // abc() is static and is called by some other cpp files of my code
    2. void Global::abc(){
    3. // start_abc() is not static so it cannot be called as Global::start_abc(), that's why I'm making an object here
    4. Global *live = new Global();
    5. live->start_abc();
    6. }
    To copy to clipboard, switch view to plain text mode 

    And:
    Qt Code:
    1. error: undefined reference to `vtable for Global'
    To copy to clipboard, switch view to plain text mode 

    I feel that it's obvious BUT :/
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Undefined reference to vtable.

    Probably the error message has nothing to do with something being static or "this or that". For some pointers about where the problem might be, see http://www.theirishpenguin.com/2007/...nce-to-vtable/

  3. The following user says thank you to mvuori for this useful post:

    hakermania (10th September 2011)

  4. #3
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Undefined reference to vtable.

    I don't know how this was solved but I edited my project file, did the change back(so actually nothing changed), saved the project file, compiled and no error...

    Is this odd?
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  5. #4
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Undefined reference to vtable.

    No; I was about to suggest that you simply try doing a 'make clean' and a rebuild. This is most often the cure for vtable errors; a symbol table mismatch occurs because of some change, usually in the headers and usually because one of the Qt tools hasn't been run on the altered file to update its Qt macros and other features.

Similar Threads

  1. undefined reference to 'vtable ...'
    By GUIman in forum Newbie
    Replies: 5
    Last Post: 10th March 2011, 01:38
  2. Qt Undefined Reference to vtable
    By ctote in forum Qt Programming
    Replies: 18
    Last Post: 24th February 2010, 22:24
  3. Undefined reference to 'vtable for XXX'
    By Sheng in forum Qt Programming
    Replies: 4
    Last Post: 17th October 2008, 15:59
  4. undefined reference to vtable
    By renjithmamman in forum Qt Programming
    Replies: 5
    Last Post: 2nd July 2006, 04:23

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.