[Qt-interest] undefined reference to `vtable for StringListModel'

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Mon Mar 16 14:30:04 CET 2009


Phil wrote:

> Hi
>   Sorry if this is more of a C++ question then QT.  I was 
> going through a QT 
> Help example and was trying to build it but get the error message:-
>  
> main.o(.gnu.linkonce.t._ZN15StringListModelC1ERK11QStringListP
> 7QObject[StringListModel::StringListModel(QStringList 
> const&, QObject*)]+0x1a): In function 
> `StringListModel::StringListModel(QStringList const&, QObject*)':
> /home/philp/MODEL_VIEW/QAbstractListModelExample/stringListModel.h:7: 
> undefined reference to `vtable for StringListModel'
> 

sniped code

> I am trying to learn as much as I can about C++ & QT but I 
> dont find this 
> error message very helpful...can anybody explain what I am 
> doing wrong.
> 
> Thanks for your help
> 
> Phil

Hi Phil, 

I think this means that the header file is not being processed by moc - make
sure you have added the header file in your .pro: 

HEADERS += stringListModel.h

After running qmake, you should see that a file moc_stringListModel.cpp is
generated and is being compiled and linked. 

Hope that helps, 

Tony.





More information about the Qt-interest-old mailing list