Solved Linker Error in Qt v5.6
-
Hi, I am student of Electrical Engineering. I am new to programming frameworks, I decided to use QT for GUI development of my end-semester programming project. But problem I am getting an error about linking which is given below:
How can I resolve this issue?
-
It looks like you created a console application and trying to add widgets to it.
Since you're using a widget (push button) you need to useQApplication
instead ofQCoreApplication
. There are basically 3 subclasses:
QCoreApplication
is for apps wthout ui (e.g. console apps)
QGuiApplication
is for non-widget based ui apps (e.g. using QWindow or QML)
QApplication
is for widget based apps, like yours.To use widgets make sure you have that module enabled. You will also need gui module. Open your .pro file and make sure these modules are enabled like this:
QT += core gui widgets
Ifgui
orwidgets
is missing add it and clickBuild->Run qmake
. After that your project should build. -
Thanks for solution!!!