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:
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:
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?
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'
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'|
Comment