Results 1 to 6 of 6

Thread: linker error: undefined reference to vtable for MainWindow

  1. #1
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default linker error: undefined reference to vtable for MainWindow

    (subject) is the error I get when compiling the same program that compiled without problems in qt 4.0.1 and dev-c++. Now I use qt 4.1.0.
    Perhaps I need to reboot windows? Any better ideas?
    The strange thing is that I haven't changed anything in the source.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: linker error: undefined reference to vtable for MainWindow

    Could we see the code? And an explanation how did you divide into files?

  3. #3
    Join Date
    Feb 2006
    Location
    Österreich
    Posts
    35
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: linker error: undefined reference to vtable for MainWindow

    Hi,

    I got this error a few days ago after installing 4.1. For some reason 3.x wasn't as uptight about class declarations in .cpp files as the new ones. Just make sure any class which uses Q_OBJECT is prototyped in a header file so you can run qmake and update the project file so that moc will be able to generate the .moc code for its signals and slots and other crazy doodads required by Qt. If you really don't want to make a header file because it might take too long to separate everything, I think this is when it is necessary to #include main.moc at the end of your main.cpp file and hope everything is all right when you run qmake again.
    My philosophy is: If you can use a free, open-source alternative: do it. And if you can't, pretend it's free and open-source and hope you don't get caught.

  4. #4
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: linker error: undefined reference to vtable for MainWindow

    I attached the code in the zip file.
    Attached Files Attached Files

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: linker error: undefined reference to vtable for MainWindow

    Apart from the fact there is a .pro file missing and "Textvisare.h" seems incorrect, the project links fine on my gcc installation.

  6. #6
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: linker error: undefined reference to vtable for MainWindow

    Thanks for looking. I will have a second look at it tommorrow when I'm not sleepy.
    A last question, I started a new project and got this error:

    windews.exe susning.ico unexpected EOF

    susning is the name of the project. I added the ico file from another project. I don't know why it needs ico files.
    In dev-c++ it also says:

    [Resource error] susning.ico unexpected EOF.

    I don't know how to solve this one, or how to avoid it either. Any ideas?

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  3. MS Sql native driver??
    By LordQt in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2007, 13:41
  4. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 14:28
  5. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15

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.