1
votes

I am trying to port my Qt4 Vs2005 project to Qt5 Vs2012. After editing include paths and changing linker dependencies from QtCored4.lib;QtGuid4.lib;QtNetworkd4.lib; to Qt5Cored.lib;Qt5Guid.lib;Qt5Networkd.lib; i still get hundreds of linking errors:

1>main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: void __thiscall QWidget::showMaximized(void)" (__imp_?showMaximized@QWidget@@QAEXXZ)" in Funktion "_main". 1>main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall QApplication::QApplication(int &,char * *,int)" (__imp_??0QApplication@@QAE@AAHPAPADH@Z)" in Funktion "_main". 1>main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: virtual __thiscall QApplication::~QApplication(void)" (__imp_??1QApplication@@UAE@XZ)" in Funktion "_main". 1>main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: static int __cdecl QApplication::exec(void)" (__imp_?exec@QApplication@@SAHXZ)" in Funktion "_main". 1>object.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall QWidget::QWidget(class QWidget *,class QFlags)" (__imp_??0QWidget@@QAE@PAV0@V?$QFlags@W4WindowType@Qt@@@@@Z)" in Funktion ""public: __thiscall Object::Object(class QWidget *)" (??0Object@@QAE@PAVQWidget@@@Z)". 1>ppi.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall QWidget::QWidget(class QWidget *,class QFlags)" (__imp_??0QWidget@@QAE@PAV0@V?$QFlags@W4WindowType@Qt@@@@@Z)".

Here it is told to run qmake from project window, but i cannot find any button for qmake?

StackOverflow

Thank you!

1
You need to add Qt5Widgetsd.lib, did you do it?Vladimir Bershov
Thank you this solves the problem! The only problem now is, that qt prints a questionmark into a black square instead of printing the degree sign °, but i think i will fix that later. Is there an easier way to port Qt-projects or is this the right way how i did it?honiahaka10

1 Answers

1
votes

Migrating from Qt4 to Qt5 in Visual Studio

  1. Simply open your project in the new ver. of Visual Studio with integrated to it Qt5
  2. Open menu Qt5 -> Qt Project Settings: Menu Qt5 in VS2012
  3. In the Properties tab, select the required version of Qt5: enter image description here
  4. Switch to the Qt Modules tab and check the required modules. Usually, you should select Core, Gui and Widgets, and may be some others (depending of your project): enter image description here
  5. Press Ok, and then go to the menu Project -> your_proj_name Properties: enter image description here
  6. Go to the Configuration Properties -> Linker -> Input -> Additional Dependecies, and then remove old dependecies from Qt4 libs. (Do not forget to do it for all of your Configurations (Debug, Release, etc.) enter image description here enter image description here