[Qt-interest] Frequent error - help pls

Thiago Macieira thiago.macieira at trolltech.com
Mon Aug 31 20:57:30 CEST 2009


Em Segunda-feira 31. Agosto 2009, às 20.48.15, você escreveu:
> class Question
> {
> public:
>     enum Type {TrueFalse, SingleChoice};
>     Type QuestionType;
>     QuestionData *Data;
>     void LoadData (Question *Data);
> private:
>     virtual void Save ();
> };
> 


> ~~~~~~~~~~~~~~
> 
> The problem arises when I try to declare any Question object; it says :
> D:/Qt/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits
> /locale_facets.tcc:2498: undefined reference to `vtable for Question'
> 
	
The vtable for Question is emitted alongside the Question::Save() function 
(the first non-inline virtual function).

So, please check that you did define that function somewhere and that the .cpp 
where it is defined is compiled and linked into your executable.

Note: you should add a virtual destructor.

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Development Frameworks
     Sandakerveien 116, NO-0402 Oslo, Norway

Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14     San Francisco, California: Nov 2 - 4
      http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090831/df60f367/attachment.bin 


More information about the Qt-interest-old mailing list