Important: Please read the Qt Code of Conduct -

Problems porting from ver 4 to ver 5

  • First, apologies if this as been answered already - whenever I try a search I get "Loading ..." but nothing ever happens.

    I have a small Windows desktop application I started a while ago under ver 4 and MinGW. I just downloaded MS-VS 2012 Express and the latest Qt, 32bit. I loaded my app and went through the process of debugging the build for the updated Qt object hierarchy, and for some bug where things like #include <QApplication> wouldn't work and I had to change it to #include <QtWidgets/QApplication>. When I got all the compiler errors fixed I now get a ton of linker errors e.g.:

    LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWidget::show(void)" (_imp?show@QWidget@@QAEXXZ) referenced in function _main

    LNK2001: unresolved external symbol "protected: virtual void __thiscall QLabel::changeEvent(class QEvent *)" (?changeEvent@QLabel@@MAEXPAVQEvent@@@Z)

    I am able to make a new Applications QtWidgets Application for the Desktop which compiles and runs and pops up a blank window.


  • Moderators

    Hi, and welcome to the Qt Dev Net!

    In Qt 4, widgets (and QApplication) were in the Qt GUI module. In Qt 5, they have been moved to the Qt Widgets module. so, you need to tell your .pro file to look for the Qt Widgets module by adding this line:
    @QT += widgets@

    See also

  • Thanks, but that didn't eliminate any of the 600+ linker errors.

    Other suggestions?


  • Lifetime Qt Champion


    did you re-run qmake after adding that line ? If it doesn't help, do a complete rebuild

  • Success!

    I've been away from Qt programming for a while now and forgot I needed to run qmake.


Log in to reply