PDA

View Full Version : linker error: undefined reference to vtable for MainWindow



Morea
14th February 2006, 23:59
(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.

wysota
15th February 2006, 00:03
Could we see the code? And an explanation how did you divide into files?

michel
15th February 2006, 00:14
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.

Morea
15th February 2006, 00:26
I attached the code in the zip file.

wysota
15th February 2006, 00:36
Apart from the fact there is a .pro file missing and "Textvisare.h" seems incorrect, the project links fine on my gcc installation.

Morea
15th February 2006, 00:43
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?