Qt Creator - Undefined reference to...
-
Hello everybody,
I just intalled Qt Creator on my Ubuntu 12.10 (Qt 5.0 : library+Qt Creator on this webpage : http://qt-project.org/downloads).
But I have buikd errors :- /home/myusername/Documents/Cpp/Qt/testQt-build-Desktop_Qt_5_0_1_GCC_32bit-Debug/../testQt/main.cpp:7: undefined reference to `QApplication::QApplication(int&, char**, int)'
- /home/myusername/Documents/Cpp/Qt/testQt-build-Desktop_Qt_5_0_1_GCC_32bit-Debug/../testQt/main.cpp:8: undefined reference to `QPushButton::QPushButton(QString const&, QWidget*)'
- /home/myusername/Documents/Cpp/Qt/testQt-build-Desktop_Qt_5_0_1_GCC_32bit-Debug/../testQt/main.cpp:10: undefined reference to `QWidget::show()'
- Etc.
I know it's link errors. But I don't know how to fix theses errors...
My .pro file is :@SOURCES +=
main.cpp@and my main.cpp is :
@#include <iostream>
#include <QtWidgets/QApplication>
#include <QtWidgets/QPushButton>int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QPushButton button("Push Me");button.show(); return app.exec();
}@
My Qt5.0.1 folder is in /home/myusername/ .
If someone can help me... it could be great! ;D
Thanks!
-
welcome to devnet
It looks a bit as you are using qt creator only as editor. The pro-file should have some more statements.
Start out in qt creator with a fresh new project based on template "Qt GUI application". I would assume that this would help, if the overall setup is correct.
-
try to add "QT += widgets" to .pro file.
QtWidgets is seperate module in Qt5.
http://doc-snapshot.qt-project.org/5.0/qtwidgets/qtwidgets-index.html