Nominate our 2022 Qt Champions!

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?

  • Moderators

    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 use QApplication instead of QCoreApplication. 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
    If gui or widgets is missing add it and click Build->Run qmake. After that your project should build.

  • Thanks for solution!!!

Log in to reply