qt-interest@trolltech.com
[Top] [All Lists]

Re: udefined reference to vtable, how get rid of?

Subject: Re: udefined reference to vtable, how get rid of?
From: tj
Date: Wed, 10 Nov 2004 15:39:46 -0500
Chris Thompson wrote:

On November 10, 2004 12:21 pm, tj wrote:
I am trying to learn how to use Qt after years of using xforms for X
apps. I went through the cannonball game tutorials and then started
playing on my own, especially with QTextEdit. I overrode ::append to do
some testing and that was ok. But, when I tried to add a new slot the
trouble began.
First I didn't put Q_OBJECT in the class declaration and got a runtime
message saying the connect failed. Ok, then I added Q_OBJECT and got the
"undefined reference to 'vtable for mtTextEdit' error.

I removed Makefile and the .pro file and reran
qmake -project
qmake
before building. Which, according to my research on other posts, should
take care of the meta code compiling.

Are you SURE that you did this AFTER adding the Q_OBJECT reference? Try deleting the existing Makefiles, then redoing it.

If that doesn't work, make sure it is creating and linking the moc file for myTextEdit.

Here is what happens starting with only main.cpp.
>qmake -project
directory now contains
main.cpp test1.pro
>qmake
directory now contains
Makefile main.cpp test1.pro
>make
<undefined reference to vtable errors>
directory now contains
Makefile main.cpp main.o test1.pro

No moc files, which is teh reason for the problems, but why no moc files?

tj

--
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>