Debug my Qt program

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

 



Hi All!
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.

Himanshu Arora


-- 
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