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

Fanda Vacek fanda.vacek at volny.cz
Wed Jan 21 12:39:37 CET 2009


just run qmake to update your makefiles, this error appears when a new  
Q_OBJECT object is declared in an existing header file.

fanda

On Tue, 20 Jan 2009 22:57:28 +0100, Scott Aron Bloom  
<Scott.Bloom at sabgroup.com> wrote:

> Did you read the docs?  Did you try searching google?
>
> Just a suggestion...
>
> Did you run qmake to create your makefile?  Are all your header files in
> the project file?
>
> Scott
>
>> -----Original Message-----
>> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
>> bounces at trolltech.com] On Behalf Of Kermit Mei
>> Sent: Tuesday, January 20, 2009 1:49 PM
>> To: qt-china at googlegroups.com; qt-interest at trolltech.com
>> Subject: [Qt-interest] undefined reference to `vtable for
> ScannerWidget' ?
>>
>> Hello, I defined a class ScannerWidget, but
>> I don't konw why the error is like this:
>>
>> $ make
>> Linking CXX executable ../bin/FreeRecite-core
>> gui/libFreeReciteGui.so: undefined reference to `vtable for
> ScannerWidget'
>> gui/libFreeReciteGui.so: undefined reference to
>> `ScannerWidget::complished()'
>> gui/libFreeReciteGui.so: undefined reference to
>> `ScannerWidget::qt_metacall(QMetaObject::Call, int, void**)'
>> gui/libFreeReciteGui.so: undefined reference to `vtable for
> ReciterWidget'
>> gui/libFreeReciteGui.so: undefined reference to
>> `ReciterWidget::staticMetaObject'
>> gui/libFreeReciteGui.so: undefined reference to `typeinfo for
> ScannerWidget'
>> gui/libFreeReciteGui.so: undefined reference to `vtable for
> MainWindow'
>> gui/libFreeReciteGui.so: undefined reference to
>> `ScannerWidget::staticMetaObject'
>> gui/libFreeReciteGui.so: undefined reference to
>> `ScannerWidget::metaObject() const'
>> gui/libFreeReciteGui.so: undefined reference to
>> `ScannerWidget::qt_metacast(char const*)'
>> collect2: ld returned 1 exit status
>>
>>
>> What may couse errors like this? Can anyone give me some tip?
>>
>>
>>
>> My header is as the following:
>>
>>
>> #ifndef FR_SCANNERWIDGET_H
>> #define FR_SCANNERWIDGET_H
>>
>> #include "ui_ScannerWidget.h"
>>
>> namespace freeRecite {
>> class Scanner;
>> }
>>
>> class ScannerWidget : public QWidget,
>>                       public Ui::ScannerWidget
>> {
>>   Q_OBJECT
>> public:
>>   explicit ScannerWidget(QWidget *parent = 0);
>>   ~ScannerWidget();
>>   virtual void start(time_t taskID) = 0;
>> signals:
>>   void complished();
>> protected slots:
>>   void lineReturned();
>>   void showNext();
>>   void showAnswer();
>>   void add();
>>   void remove();
>>   void modify();
>> protected:
>>   void setInfo();
>>   void complish();
>>
>>   freeRecite::Scanner *scanner;
>>   bool freeze; //If freeze == true, the lineEdit is showing the
>> answer.
>>   time_t startTime;
>>   int maxBar;
>> };
>>
>> #endif //FR_SCANNERWIDGET_H
>>
>>
>> Thank you!
>> Kermit Mei
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the Qt-interest-old mailing list