Porting Qt4 to Qt5: unresolved external symbols



  • Qt5 is the new generation of Qt and it has some changes.

    I have a project building well with Qt4. I've downloaded Qt5-VisualStudio2010 package and I'm trying to port my project from Qt4 to Qt5. Problems arise.

    All 'include' paths have been fixed well. However, the compiler now reports hundreds of 'unresolved external symbols' (almost all function calls, sounds like the compiler can't find any .lib file). I even tried to add all .lib files found in the Qt SDK folder, but useless. The most basic class and method: QApplication::exec(...) also reported as 'unresolved symbol'.

    The project file has been changed to fit Qt5 packaging:

    myproject.pro file:
    QT += core gui widgets

    Anyone have got similar experience with this new release of Qt?



  • from qt_newbie89 (http://qt-project.org/forums/viewthread/23200):
    I have “accidentally” solved the problem.
    I rightclicked on the project folder in the Project windows and choose qmake. After that, choose Run and all the errors disappeared.
    I don’t know why that works by the way.

    yeah, that really solves the linking problem!



  • Yupp... Even I faced that Problem.. Then i just tried with the qmake and chose Run.. It Worked Fine...

    Thanks & Regards



  • My project was created with Qt4, the 'make' file was also created along with the project nicely. When I removed Qt4, installed Qt5 and imported the old project by Qt5 (with new Qt Creator), possibly the 'make' file became corrupted.



  • The Makefile file did not "become corrupted": it was exactly as you left it, full of commands and paths suitable for the previous Qt 4 installation. When Qt Creator ran nmake to build the project nmake did not automatically re-run qmake to generate the Makefile because the (untouched) Makefile was newer than the pro file that generated it. This is normal and correct make behaviour, but it resulted in a mismatch between your Qt5 in stall and expected Qt4 install.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.