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.
Bookmarks