Re: Debug my Qt program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 17 Oct 2003 00:41:31 +0530 (IST), Himanshu Arora wrote:

> I'm getting some errors in my Qt program which is very hard for me to 
> understand as i am new to Qt.
> The code is :
> 
> 
> #include <qpopupmenu.h>
> #include <qapplication.h>
> #include <qmainwindow.h>
> #include <qmenubar.h>
> 
> class ApplicationWindow : public QMainWindow
> {
>         Q_OBJECT
> public:
>         ApplicationWindow();
> };
> 
> ApplicationWindow::ApplicationWindow()
>         : QMainWindow(0, "Himanshu Arora", WDestructiveClose )
> {
>         QPopupMenu * file = new QPopupMenu(this);
>         menuBar()->insertItem("&File", file);
>         file->insertItem("&Open", this, SLOT(open()), CTRL+Key_O);
>         file->insertItem("E&xit", this, SLOT(quit()), CTRL+Key_X);
> }
> 
> int main(int argc, char **argv)
> {
>         QApplication a(argc, argv);
>         ApplicationWindow *mw = new ApplicationWindow();
>         mw->show();
>         a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
>         return a.exec();
> }
> 
> 
> -----------------------
> The error which i'm getting is : 
> + qmake -project popup.cpp
> + qmake
> + make
> g++  -o popup popup.o   -L/usr/lib/qt-3.1/lib -L/usr/X11R6/lib -lqt-mt 
> -lXext -lX11 -lm
> popup.o(.text+0x31): In function 
> `ApplicationWindow::ApplicationWindow[not-in-charge]()':
> /home/project/learnQt/popup/popup.cpp:18: undefined reference to `vtable 
> for ApplicationWindow'
> popup.o(.text+0x38):/home/project/learnQt/popup/popup.cpp:18: undefined 
> reference to `vtable for ApplicationWindow'
> popup.o(.text+0x1f1): In function 
> `ApplicationWindow::ApplicationWindow[in-charge]()':
> /home/project/learnQt/popup/popup.cpp:18: undefined reference to `vtable 
> for ApplicationWindow'
> popup.o(.text+0x1f8):/home/project/learnQt/popup/popup.cpp:18: undefined 
> reference to `vtable for ApplicationWindow'
> collect2: ld returned 1 exit status
> make: *** [popup] Error 1
> 
> i have to learn Qt within 3 or 4 days is there any good documentation or 
> short tutorial apart from that provided by Trolltech. While replying to 
> the redhat mailing list please send a Cc to me with the corrected code.
> Please explain the errors also.



>         Q_OBJECT

Where's the corresponding code for Qt's Meta Object Compiler? Your
example code looks incomplete. That's why you get a linker error.


- -- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/jwti0iMVcrivHFQRArN3AJwPcFD9XuNO5at+HAwcAHGYJfwuagCeK2QJ
sqv0LHUict46AjGN7ACtc+k=
=wK5o
-----END PGP SIGNATURE-----


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux