Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, May 2007
Subclassing MainWindow


Message 1 in thread

Hi All,

I am using Qt version:: 4.2.3.
                  Operating System::  Linux.
                   Compiler :: gcc.
                 
When iam designing a window in Qt Designer and subclassing the Window as 
follow.


class MainWindow : public QMainWindow   ///subclassing
 {
     Q_OBJECT

 public:
    MainWindow(QWidget *parent=0);   
   ~MainWindow();

 private:

     Ui::MainWindow1 ui; 
 };


MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
 {
    ui.setupUi(this);
 }


int main(int argc, char *argv[])  ////main
 {
     QApplication app(argc, argv);
     MainWindow window;
     window.show();
     return app.exec();
     }

iam getting following error.




Warning: File `Makefile' has modification time 42 s in the future
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT  -DQT_NO_DEBUG -DQT_GUI_LIB 
-DQT_CORE_LIB -DQT_SHARED -I/opt/qt/qt4.2.3/mkspecs/default -I. 
-I/opt/qt/qt4.2.3/include/QtCore -I/opt/qt/qt4.2.3/include/QtCore 
-I/opt/qt/qt4.2.3/include/QtGui -I/opt/qt/qt4.2.3/include/QtGui 
-I/opt/qt/qt4.2.3/include -I. -I. -I. -o main.o main.cpp
g++ -m64 -Wl,-rpath,/opt/qt/qt4.2.3/lib -o QT4170507 main.o    
-L/opt/qt/qt4.2.3//lib -lQtGui -L/opt/qt/qt-x11-opensource-src-4.2.3/lib 
-L/usr/X11R6/lib64 -lSM -lICE -lXi -lXrender -lXrandr -lXcursor 
-lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl 
-lpthread
main.o(.text+0x28): In function 
`MainWindow::MainWindow[in-charge](QWidget*)':
: undefined reference to `vtable for MainWindow'
main.o(.text+0x30): In function 
`MainWindow::MainWindow[in-charge](QWidget*)':
: undefined reference to `vtable for MainWindow'
main.o(.text+0xd1): In function `main':
: undefined reference to `MainWindow::~MainWindow [in-charge]()'
main.o(.text+0x11a): In function `main':
: undefined reference to `MainWindow::~MainWindow [in-charge]()'
main.o(.text+0x148): In function 
`MainWindow::MainWindow[not-in-charge](QWidget*)':
: undefined reference to `vtable for MainWindow'
main.o(.text+0x150): In function 
`MainWindow::MainWindow[not-in-charge](QWidget*)':
: undefined reference to `vtable for MainWindow'
collect2: ld returned 1 exit status
make: *** [QT4170507] Error 1

..Please correct me  if  iam wrong.

regards,
basha.
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


--
 [ signature omitted ] 

Message 2 in thread

Ah, seen this before. Basically, if you see something like "undefined
reference to `vtable for ...." it usually means that the MOC
(metaobject compiler) is not invoked as it should.

Note that if you make a project, add some sources, run qmake to make
the Makefile and after that you add Q_OBJECT macro to any source code,
you have to re-run qmake to re-generate the makefile. If you do it,.
qmake will notice Q_OBJECT macro was added and will add rules to
generate moc_main.cpp and moc_main.o - which is what is missing to
compile successfully.

So simple solution - rerun qmake for your project to re-generate the
Makefile. Then try compiling again.

Martin Petricek


On 5/24/07, Basha J P M <basha.jpm@xxxxxxx> wrote:
> Hi All,
>
> I am using Qt version:: 4.2.3.
>                   Operating System::  Linux.
>                    Compiler :: gcc.
>
> When iam designing a window in Qt Designer and subclassing the Window as
> follow.
>
>
> class MainWindow : public QMainWindow   ///subclassing
>  {
>      Q_OBJECT
>
>  public:
>     MainWindow(QWidget *parent=0);
>    ~MainWindow();
>
>  private:
>
>      Ui::MainWindow1 ui;
>  };
>
>
> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
>  {
>     ui.setupUi(this);
>  }
>
>
> int main(int argc, char *argv[])  ////main
>  {
>      QApplication app(argc, argv);
>      MainWindow window;
>      window.show();
>      return app.exec();
>      }
>
> iam getting following error.
>
>
>
>
> Warning: File `Makefile' has modification time 42 s in the future
> g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT  -DQT_NO_DEBUG -DQT_GUI_LIB
> -DQT_CORE_LIB -DQT_SHARED -I/opt/qt/qt4.2.3/mkspecs/default -I.
> -I/opt/qt/qt4.2.3/include/QtCore -I/opt/qt/qt4.2.3/include/QtCore
> -I/opt/qt/qt4.2.3/include/QtGui -I/opt/qt/qt4.2.3/include/QtGui
> -I/opt/qt/qt4.2.3/include -I. -I. -I. -o main.o main.cpp
> g++ -m64 -Wl,-rpath,/opt/qt/qt4.2.3/lib -o QT4170507 main.o
> -L/opt/qt/qt4.2.3//lib -lQtGui -L/opt/qt/qt-x11-opensource-src-4.2.3/lib
> -L/usr/X11R6/lib64 -lSM -lICE -lXi -lXrender -lXrandr -lXcursor
> -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl
> -lpthread
> main.o(.text+0x28): In function
> `MainWindow::MainWindow[in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> main.o(.text+0x30): In function
> `MainWindow::MainWindow[in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> main.o(.text+0xd1): In function `main':
> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
> main.o(.text+0x11a): In function `main':
> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
> main.o(.text+0x148): In function
> `MainWindow::MainWindow[not-in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> main.o(.text+0x150): In function
> `MainWindow::MainWindow[not-in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> collect2: ld returned 1 exit status
> make: *** [QT4170507] Error 1
>
> ..Please correct me  if  iam wrong.
>
> regards,
> basha.
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ] 

Message 3 in thread

I will assume this is currently all in one source file. You really 
should put your MainWindow declaration in a header file. Add that new 
file to the HEADERS line in your .pro and qmake will take care of the rest.

--Justin

Basha J P M wrote:
> Hi All,
>
> I am using Qt version:: 4.2.3.
>                  Operating System::  Linux.
>                   Compiler :: gcc.
>                 When iam designing a window in Qt Designer and 
> subclassing the Window as follow.
>
>
> class MainWindow : public QMainWindow   ///subclassing
> {
>     Q_OBJECT
>
> public:
>    MainWindow(QWidget *parent=0);     ~MainWindow();
>
> private:
>
>     Ui::MainWindow1 ui; };
>
>
> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
> {
>    ui.setupUi(this);
> }
>
>
> int main(int argc, char *argv[])  ////main
> {
>     QApplication app(argc, argv);
>     MainWindow window;
>     window.show();
>     return app.exec();
>     }
>
> iam getting following error.
>
>
>
>
> Warning: File `Makefile' has modification time 42 s in the future
> g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT  -DQT_NO_DEBUG 
> -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED 
> -I/opt/qt/qt4.2.3/mkspecs/default -I. -I/opt/qt/qt4.2.3/include/QtCore 
> -I/opt/qt/qt4.2.3/include/QtCore -I/opt/qt/qt4.2.3/include/QtGui 
> -I/opt/qt/qt4.2.3/include/QtGui -I/opt/qt/qt4.2.3/include -I. -I. -I. 
> -o main.o main.cpp
> g++ -m64 -Wl,-rpath,/opt/qt/qt4.2.3/lib -o QT4170507 main.o    
> -L/opt/qt/qt4.2.3//lib -lQtGui 
> -L/opt/qt/qt-x11-opensource-src-4.2.3/lib -L/usr/X11R6/lib64 -lSM 
> -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype 
> -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl -lpthread
> main.o(.text+0x28): In function 
> `MainWindow::MainWindow[in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> main.o(.text+0x30): In function 
> `MainWindow::MainWindow[in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> main.o(.text+0xd1): In function `main':
> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
> main.o(.text+0x11a): In function `main':
> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
> main.o(.text+0x148): In function 
> `MainWindow::MainWindow[not-in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> main.o(.text+0x150): In function 
> `MainWindow::MainWindow[not-in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> collect2: ld returned 1 exit status
> make: *** [QT4170507] Error 1
>
> ..Please correct me  if  iam wrong.
>
> regards,
> basha.
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain confidential or 
> privileged information. If you are not the intended recipient, any 
> dissemination, use, review, distribution, printing or copying of the 
> information contained in this e-mail message and/or attachments to it 
> are strictly prohibited. If you have received this communication in 
> error, please notify us by reply e-mail or telephone and immediately 
> and permanently delete the message and any attachments. Thank you
>
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>

begin:vcard
begin:vcard
fn:Justin Noel
n:Noel;Justin
org:ICS;Engineering
adr:;;54B Middlesex Trpk;Bedford;MA;01730;USA
email;internet:justin@xxxxxxx
title:Sr. Consulting Engineer / Certified Qt Instructor
tel;work:(617) 621-0060
url:http://www.ics.com
version:2.1
end:vcard


Message 4 in thread

You get this error if you declare a method in your class but don't 
implement it.  I believe the implementation of your distructor is missing.

Justin Noel wrote:
>
> I will assume this is currently all in one source file. You really 
> should put your MainWindow declaration in a header file. Add that new 
> file to the HEADERS line in your .pro and qmake will take care of the 
> rest.
>
> --Justin
>
> Basha J P M wrote:
>> Hi All,
>>
>> I am using Qt version:: 4.2.3.
>>                  Operating System::  Linux.
>>                   Compiler :: gcc.
>>                 When iam designing a window in Qt Designer and 
>> subclassing the Window as follow.
>>
>>
>> class MainWindow : public QMainWindow   ///subclassing
>> {
>>     Q_OBJECT
>>
>> public:
>>    MainWindow(QWidget *parent=0);     ~MainWindow();
>>
>> private:
>>
>>     Ui::MainWindow1 ui; };
>>
>>
>> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
>> {
>>    ui.setupUi(this);
>> }
>>
>>
>> int main(int argc, char *argv[])  ////main
>> {
>>     QApplication app(argc, argv);
>>     MainWindow window;
>>     window.show();
>>     return app.exec();
>>     }
>>
>> iam getting following error.
>>
>>
>>
>>
>> Warning: File `Makefile' has modification time 42 s in the future
>> g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT  -DQT_NO_DEBUG 
>> -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED 
>> -I/opt/qt/qt4.2.3/mkspecs/default -I. 
>> -I/opt/qt/qt4.2.3/include/QtCore -I/opt/qt/qt4.2.3/include/QtCore 
>> -I/opt/qt/qt4.2.3/include/QtGui -I/opt/qt/qt4.2.3/include/QtGui 
>> -I/opt/qt/qt4.2.3/include -I. -I. -I. -o main.o main.cpp
>> g++ -m64 -Wl,-rpath,/opt/qt/qt4.2.3/lib -o QT4170507 main.o    
>> -L/opt/qt/qt4.2.3//lib -lQtGui 
>> -L/opt/qt/qt-x11-opensource-src-4.2.3/lib -L/usr/X11R6/lib64 -lSM 
>> -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype 
>> -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl -lpthread
>> main.o(.text+0x28): In function 
>> `MainWindow::MainWindow[in-charge](QWidget*)':
>> : undefined reference to `vtable for MainWindow'
>> main.o(.text+0x30): In function 
>> `MainWindow::MainWindow[in-charge](QWidget*)':
>> : undefined reference to `vtable for MainWindow'
>> main.o(.text+0xd1): In function `main':
>> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
>> main.o(.text+0x11a): In function `main':
>> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
>> main.o(.text+0x148): In function 
>> `MainWindow::MainWindow[not-in-charge](QWidget*)':
>> : undefined reference to `vtable for MainWindow'
>> main.o(.text+0x150): In function 
>> `MainWindow::MainWindow[not-in-charge](QWidget*)':
>> : undefined reference to `vtable for MainWindow'
>> collect2: ld returned 1 exit status
>> make: *** [QT4170507] Error 1
>>
>> ..Please correct me  if  iam wrong.
>>
>> regards,
>> basha.
>> =====-----=====-----=====
>> Notice: The information contained in this e-mail
>> message and/or attachments to it may contain confidential or 
>> privileged information. If you are not the intended recipient, any 
>> dissemination, use, review, distribution, printing or copying of the 
>> information contained in this e-mail message and/or attachments to it 
>> are strictly prohibited. If you have received this communication in 
>> error, please notify us by reply e-mail or telephone and immediately 
>> and permanently delete the message and any attachments. Thank you
>>
>>
>> -- 
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx 
>> with "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>



---

This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.

Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.

--
 [ signature omitted ] 

Message 5 in thread

Susan Macchia wrote:
> You get this error if you declare a method in your class but don't 
> implement it.  I believe the implementation of your distructor is 
> missing.
>
I meant "destructor"  (sometimes I type too fast and hit the send key to 
early - apologies)



---

This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.

Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.

--
 [ signature omitted ] 

Message 6 in thread

I have to put MainWindow declaration in the header file .Then MOC file 
is getting created and its working.
thanks,

regards,
basha.


Susan Macchia wrote:

> You get this error if you declare a method in your class but don't 
> implement it.  I believe the implementation of your distructor is 
> missing.
>
> Justin Noel wrote:
>
>>
>> I will assume this is currently all in one source file. You really 
>> should put your MainWindow declaration in a header file. Add that new 
>> file to the HEADERS line in your .pro and qmake will take care of the 
>> rest.
>>
>> --Justin
>>
>> Basha J P M wrote:
>>
>>> Hi All,
>>>
>>> I am using Qt version:: 4.2.3.
>>>                  Operating System::  Linux.
>>>                   Compiler :: gcc.
>>>                 When iam designing a window in Qt Designer and 
>>> subclassing the Window as follow.
>>>
>>>
>>> class MainWindow : public QMainWindow   ///subclassing
>>> {
>>>     Q_OBJECT
>>>
>>> public:
>>>    MainWindow(QWidget *parent=0);     ~MainWindow();
>>>
>>> private:
>>>
>>>     Ui::MainWindow1 ui; };
>>>
>>>
>>> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
>>> {
>>>    ui.setupUi(this);
>>> }
>>>
>>>
>>> int main(int argc, char *argv[])  ////main
>>> {
>>>     QApplication app(argc, argv);
>>>     MainWindow window;
>>>     window.show();
>>>     return app.exec();
>>>     }
>>>
>>> iam getting following error.
>>>
>>>
>>>
>>>
>>> Warning: File `Makefile' has modification time 42 s in the future
>>> g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT  -DQT_NO_DEBUG 
>>> -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED 
>>> -I/opt/qt/qt4.2.3/mkspecs/default -I. 
>>> -I/opt/qt/qt4.2.3/include/QtCore -I/opt/qt/qt4.2.3/include/QtCore 
>>> -I/opt/qt/qt4.2.3/include/QtGui -I/opt/qt/qt4.2.3/include/QtGui 
>>> -I/opt/qt/qt4.2.3/include -I. -I. -I. -o main.o main.cpp
>>> g++ -m64 -Wl,-rpath,/opt/qt/qt4.2.3/lib -o QT4170507 main.o    
>>> -L/opt/qt/qt4.2.3//lib -lQtGui 
>>> -L/opt/qt/qt-x11-opensource-src-4.2.3/lib -L/usr/X11R6/lib64 -lSM 
>>> -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype 
>>> -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl -lpthread
>>> main.o(.text+0x28): In function 
>>> `MainWindow::MainWindow[in-charge](QWidget*)':
>>> : undefined reference to `vtable for MainWindow'
>>> main.o(.text+0x30): In function 
>>> `MainWindow::MainWindow[in-charge](QWidget*)':
>>> : undefined reference to `vtable for MainWindow'
>>> main.o(.text+0xd1): In function `main':
>>> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
>>> main.o(.text+0x11a): In function `main':
>>> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
>>> main.o(.text+0x148): In function 
>>> `MainWindow::MainWindow[not-in-charge](QWidget*)':
>>> : undefined reference to `vtable for MainWindow'
>>> main.o(.text+0x150): In function 
>>> `MainWindow::MainWindow[not-in-charge](QWidget*)':
>>> : undefined reference to `vtable for MainWindow'
>>> collect2: ld returned 1 exit status
>>> make: *** [QT4170507] Error 1
>>>
>>> ..Please correct me  if  iam wrong.
>>>
>>> regards,
>>> basha.
>>> =====-----=====-----=====
>>> Notice: The information contained in this e-mail
>>> message and/or attachments to it may contain confidential or 
>>> privileged information. If you are not the intended recipient, any 
>>> dissemination, use, review, distribution, printing or copying of the 
>>> information contained in this e-mail message and/or attachments to 
>>> it are strictly prohibited. If you have received this communication 
>>> in error, please notify us by reply e-mail or telephone and 
>>> immediately and permanently delete the message and any attachments. 
>>> Thank you
>>>
>>>
>>> -- 
>>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx 
>>> with "unsubscribe" in the subject or the body.
>>> List archive and information: http://lists.trolltech.com/qt-interest/
>>>
>>
>
>
>
> ---
>
> This communication contains confidential information. If you are not 
> the intended recipient please return this email to the sender and 
> delete it from your records.
>
> Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht 
> der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese 
> an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


--
 [ signature omitted ] 

Message 7 in thread

This can be caused sometimes if some file is not processed by moc. As Martin said you should put the 
Q_OBJECT macro and run qmake again. Sometimes qmake may not update the makefile (this happens when 
the files are not in your DEPENDPATH and therefore in some cases changes are not detected). To be on 
the safe side: make distclean (will remove the generated existing Makefiles) and then qmake; make to 
generate new ones.

--st

Basha J P M wrote:
> Hi All,
> 
> I am using Qt version:: 4.2.3.
>                  Operating System::  Linux.
>                   Compiler :: gcc.
>                 When iam designing a window in Qt Designer and 
> subclassing the Window as follow.
> 
> 
> class MainWindow : public QMainWindow   ///subclassing
> {
>     Q_OBJECT
> 
> public:
>    MainWindow(QWidget *parent=0);     ~MainWindow();
> 
> private:
> 
>     Ui::MainWindow1 ui; };
> 
> 
> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
> {
>    ui.setupUi(this);
> }
> 
> 
> int main(int argc, char *argv[])  ////main
> {
>     QApplication app(argc, argv);
>     MainWindow window;
>     window.show();
>     return app.exec();
>     }
> 
> iam getting following error.
> 
> 
> 
> 
> Warning: File `Makefile' has modification time 42 s in the future
> g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT  -DQT_NO_DEBUG -DQT_GUI_LIB 
> -DQT_CORE_LIB -DQT_SHARED -I/opt/qt/qt4.2.3/mkspecs/default -I. 
> -I/opt/qt/qt4.2.3/include/QtCore -I/opt/qt/qt4.2.3/include/QtCore 
> -I/opt/qt/qt4.2.3/include/QtGui -I/opt/qt/qt4.2.3/include/QtGui 
> -I/opt/qt/qt4.2.3/include -I. -I. -I. -o main.o main.cpp
> g++ -m64 -Wl,-rpath,/opt/qt/qt4.2.3/lib -o QT4170507 main.o    
> -L/opt/qt/qt4.2.3//lib -lQtGui -L/opt/qt/qt-x11-opensource-src-4.2.3/lib 
> -L/usr/X11R6/lib64 -lSM -lICE -lXi -lXrender -lXrandr -lXcursor 
> -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl 
> -lpthread
> main.o(.text+0x28): In function 
> `MainWindow::MainWindow[in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> main.o(.text+0x30): In function 
> `MainWindow::MainWindow[in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> main.o(.text+0xd1): In function `main':
> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
> main.o(.text+0x11a): In function `main':
> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
> main.o(.text+0x148): In function 
> `MainWindow::MainWindow[not-in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> main.o(.text+0x150): In function 
> `MainWindow::MainWindow[not-in-charge](QWidget*)':
> : undefined reference to `vtable for MainWindow'
> collect2: ld returned 1 exit status
> make: *** [QT4170507] Error 1
> 
> ..Please correct me  if  iam wrong.
> 
> regards,
> basha.
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain confidential or privileged 
> information. If you are not the intended recipient, any dissemination, 
> use, review, distribution, printing or copying of the information 
> contained in this e-mail message and/or attachments to it are strictly 
> prohibited. If you have received this communication in error, please 
> notify us by reply e-mail or telephone and immediately and permanently 
> delete the message and any attachments. Thank you
> 
> 
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
> 



Attachment:

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Message 8 in thread

And make sure all your declared methods are implemented.  As I said in 
another thread - this can happen if you declare a method then don't 
implement it.

Stathis wrote:
> This can be caused sometimes if some file is not processed by moc. As 
> Martin said you should put the Q_OBJECT macro and run qmake again. 
> Sometimes qmake may not update the makefile (this happens when the 
> files are not in your DEPENDPATH and therefore in some cases changes 
> are not detected). To be on the safe side: make distclean (will remove 
> the generated existing Makefiles) and then qmake; make to generate new 
> ones.
>
> --st
>
> Basha J P M wrote:
>> Hi All,
>>
>> I am using Qt version:: 4.2.3.
>>                  Operating System::  Linux.
>>                   Compiler :: gcc.
>>                 When iam designing a window in Qt Designer and 
>> subclassing the Window as follow.
>>
>>
>> class MainWindow : public QMainWindow   ///subclassing
>> {
>>     Q_OBJECT
>>
>> public:
>>    MainWindow(QWidget *parent=0);     ~MainWindow();
>>
>> private:
>>
>>     Ui::MainWindow1 ui; };
>>
>>
>> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
>> {
>>    ui.setupUi(this);
>> }
>>
>>
>> int main(int argc, char *argv[])  ////main
>> {
>>     QApplication app(argc, argv);
>>     MainWindow window;
>>     window.show();
>>     return app.exec();
>>     }
>>
>> iam getting following error.
>>
>>
>>
>>
>> Warning: File `Makefile' has modification time 42 s in the future
>> g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT  -DQT_NO_DEBUG 
>> -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED 
>> -I/opt/qt/qt4.2.3/mkspecs/default -I. 
>> -I/opt/qt/qt4.2.3/include/QtCore -I/opt/qt/qt4.2.3/include/QtCore 
>> -I/opt/qt/qt4.2.3/include/QtGui -I/opt/qt/qt4.2.3/include/QtGui 
>> -I/opt/qt/qt4.2.3/include -I. -I. -I. -o main.o main.cpp
>> g++ -m64 -Wl,-rpath,/opt/qt/qt4.2.3/lib -o QT4170507 main.o    
>> -L/opt/qt/qt4.2.3//lib -lQtGui 
>> -L/opt/qt/qt-x11-opensource-src-4.2.3/lib -L/usr/X11R6/lib64 -lSM 
>> -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype 
>> -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl -lpthread
>> main.o(.text+0x28): In function 
>> `MainWindow::MainWindow[in-charge](QWidget*)':
>> : undefined reference to `vtable for MainWindow'
>> main.o(.text+0x30): In function 
>> `MainWindow::MainWindow[in-charge](QWidget*)':
>> : undefined reference to `vtable for MainWindow'
>> main.o(.text+0xd1): In function `main':
>> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
>> main.o(.text+0x11a): In function `main':
>> : undefined reference to `MainWindow::~MainWindow [in-charge]()'
>> main.o(.text+0x148): In function 
>> `MainWindow::MainWindow[not-in-charge](QWidget*)':
>> : undefined reference to `vtable for MainWindow'
>> main.o(.text+0x150): In function 
>> `MainWindow::MainWindow[not-in-charge](QWidget*)':
>> : undefined reference to `vtable for MainWindow'
>> collect2: ld returned 1 exit status
>> make: *** [QT4170507] Error 1
>>
>> ..Please correct me  if  iam wrong.
>>
>> regards,
>> basha. 
>
>



---

This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.

Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.

--
 [ signature omitted ]