robb218
robb218

Reputation: 43

How can I compile QT 4 dlls with msvc 2019?

I have an old project using QT 4.6.2 that runs on VS 2008. I was able to compile it in VS 2019 with msvc 2019 toolchain but it crashes in run time. I see that the problem happens because when I use the QString::toStdString() function, it involves QTCore4.dll using msvc90.dll (VS2008), but when destroying the std::string the app uses msvc2019. This mismatch ends in the app crash.

I want to fix it by recompiling QTCore4.dll using the msvc 2019 but have no idea how to do this. I got the dll by installing QT and have no instructions how to recompile it.

Is it even possible or is it closed source? I assume upgrading to QT 5 is also an option but I would like to stay with QT 4 for now.

Upvotes: 0

Views: 728

Answers (1)

rubenvb
rubenvb

Reputation: 76721

Qt 5 is largely source compatible with Qt 4. I would first highly recommend trying to compile your project (and fixing any small issues) against Qt 5. If you need the Qt Declarative module, you can compile it against Qt 5 if you must.


That being said, Qt is released under the Open Source LGPL license.

You can fetch the Qt 4 source code from github: https://github.com/qt/qt

Building Qt 4 involves having perl installed and running configure followed by nmake (for Visual Studio). You will need to set up some new things for Visual Studio 2019, and potentially fix code incompatibilities that the 2019 version compiler digs up.

Upvotes: 2

Related Questions