Results 1 to 19 of 19

Thread: Qt Undefined Reference to vtable

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2009
    Location
    Greece, Chania
    Posts
    63
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Qt Undefined Reference to vtable

    What are the differences with the code you'll find in the .zip??
    Also did you rerun qmake?
    Attached Files Attached Files
    Misha R.evolution - High level Debugging IDE

    Programming is about 2 basic principles: KISS and RTFM!!!

  2. #2
    Join Date
    Jan 2010
    Posts
    23
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Undefined Reference to vtable

    Ok, here's what happened -- I ran your code and it compiled fine but no command line popped up, so I ran it again... now I get the same error every time with your code. I tried to run qmake, but it keeps saying unknown command.

    This is frustrating

    Also, I just noticed our .pro files are different... not sure if that matters:

    mine:
    Qt Code:
    1. # -------------------------------------------------
    2. # Project created by QtCreator 2010-02-24T13:23:24
    3. # -------------------------------------------------
    4. QT += network
    5. QT -= gui
    6. TARGET = jausCommandLine
    7. CONFIG += console
    8. CONFIG -= app_bundle
    9. TEMPLATE = app
    10. SOURCES += main.cpp \
    11. jaus.cpp
    12. HEADERS += jaus.h
    To copy to clipboard, switch view to plain text mode 

    yours:
    Qt Code:
    1. QT += network
    2.  
    3. TARGET = jaus
    4. TEMPLATE = app
    5.  
    6.  
    7. SOURCES += main.cpp\
    8. jaus.cpp
    9.  
    10. HEADERS += jaus.h
    To copy to clipboard, switch view to plain text mode 
    Last edited by ctote; 24th February 2010 at 21:40.

  3. #3
    Join Date
    Jan 2010
    Posts
    23
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Undefined Reference to vtable

    Just changed my .pro file for yours (except I added the CONFIG section for my command line) -- it's working great now. Why? I'm very new to Qt and don't quite understand the requirements in the .pro file (as well as the requirements for object creation e.g., Q_OBJECT).

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Undefined Reference to vtable

    Typically, if you get "Undefined Reference to vtable" whilst building a project you need to ensure MOC is being run. The easiest way to ensure this is to simply run qmake from the QtCreator menu bar and then rebuild the project. Q_OBJECT is only required if your class needs signals or slots - these are then read by MOC and parsed into another file that it creates and automatically adds to your project. Without this file, you get the vtable error.

Similar Threads

  1. undefined reference to vtable in Threads.
    By prasanth.nvs in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 20th February 2009, 10:19
  2. Undefined reference to 'vtable for XXX'
    By Sheng in forum Qt Programming
    Replies: 4
    Last Post: 17th October 2008, 15:59
  3. undefined reference to vtable
    By renjithmamman in forum Qt Programming
    Replies: 5
    Last Post: 2nd July 2006, 04:23
  4. Replies: 2
    Last Post: 30th June 2006, 18:42

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.