can't get Qt to work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Xx r3negade
    New Member
    • Apr 2008
    • 39

    can't get Qt to work

    I'm using this tutorial to learn Qt. I've gotten to the point where I've used qmake to generate the makefile and the ui_myqtapp.h file. When compiling with the Makefile, I get these errors:
    Code:
    main.o: In function `main':
    /home/jBrandt/Code/qt/main.cpp:28: undefined reference to `operator new(unsigned int)'
    myqtapp.o: In function `Ui_frmMain::setupUi(QWidget*)':
    /home/jBrandt/Code/qt/ui_myqtapp.h:48: undefined reference to `operator new(unsigned int)'
    /home/jBrandt/Code/qt/ui_myqtapp.h:51: undefined reference to `operator new(unsigned int)'
    /home/jBrandt/Code/qt/ui_myqtapp.h:54: undefined reference to `operator new(unsigned int)'
    /home/jBrandt/Code/qt/ui_myqtapp.h:57: undefined reference to `operator new(unsigned int)'
    myqtapp.o:/home/jBrandt/Code/qt/ui_myqtapp.h:60: more undefined references to `operator new(unsigned int)' follow
    moc_myqtapp.o:(.rodata._ZTV7myQtApp[vtable for myQtApp]+0xf0): undefined reference to `non-virtual thunk to QWidget::devType() const'
    moc_myqtapp.o:(.rodata._ZTV7myQtApp[vtable for myQtApp]+0xf4): undefined reference to `non-virtual thunk to QWidget::paintEngine() const'
    moc_myqtapp.o:(.rodata._ZTV7myQtApp[vtable for myQtApp]+0xf8): undefined reference to `non-virtual thunk to QWidget::metric(QPaintDevice::PaintDeviceMetric) const'
    Note that ui_myqtapp was generated automatically, so it should not contain errors.

    So I try compiling it without the makefile (gcc builds its own makefile).
    Well what do you know, it actually compiles. But then I get the link error:
    Code:
    /home/jBrandt/Code/qt/myqtapp.cpp|5|undefined reference to `vtable for myQtApp'|
    The tutorial says something about this error message, and suggests to run qmake again, which I did. I've looked on google, and have also learned that this error will also appear if you don't implement all the methods defined in the slots. Well, I have implemented all the methods, so it's giving me an error for no apparent reason. Any help?
  • sirsnorklingtayo
    New Member
    • Jan 2007
    • 26

    #2
    Have you tried to check the version of your qmake? may be you're using a different version like the old qt3 qmake version. Based on your sample tutorial you should use the Qt4 version. try to type qmake -version

    Comment

    Working...