📜 ⬆️ ⬇️

Building Qt 5.3.0 in Visual Studio 2008

Happy New Year!

Digia offers Qt5 for Windows only copied under Visual Studio 2010, and with parameters that are not ideal for everyone. In particular this


In the end, you will also consider the question of the subsequent distribution of applications without the need to install Microsoft Visual C ++ 2008 Redistributable Package when installing your program.

What is necessary



Note: since I do not need to compile qtactiveqt, qtdeclarative, qtwebkit and others, but only qtbase is needed (Qt5Core / Qt5Gui / Qt5Network / Qt5Widgets / Qt5Sql / etc) and qttools (as an assistant, designer, etc), I will only run qtbols / etc) qttools, whereas when fully compiling the library, configure should be run at the root.
Note 2 : By default, qt5 tries to use OpenGL 2 / Angle, which requires the DirectX SDK to compile. Since I do not need QML2 and OpenGL2, I use the configure -opengl desktop option, which tells QtGui to use the old opengl32.dll (OpenGL 1.1 standard, available in any Windows XP and higher). For the experiment, I also compiled with the DirectX SDK installed, in this case there will be 2 additional DLLs in the Qt5Gui.dll dependencies - libEGL.dll and libGLESv2.dll.
')

Compilation



Application distribution


A simple and convenient way to not require the installation of a Visual C ++ 2008 Redistrubutable package is to carry 3 files with you :
msvcp90.dll, msvcr90.dll and Microsoft.VC90.CRT.manifest

Here we consider a fairly simple example of an application that has been ported from Qt4 to Qt5. Previously, there were 3 Qt modules in its dependencies - QtCore4.dll, QtGui4.dll, QtNetwork4.dll. Now Qt-shny libraries 4 - Qt5Core.dll, Qt5Gui.dll, Qt5Network.dll, Qt5Widgets.dll. However, besides this, you need to carry along with you one mandatory plugin - qtbase \ plugins \ platforms \ qwindows.dll, this is a consequence of the level of abstraction from the operating system in Qt5. It is loaded implicitly, so I did not immediately figure out why the application does not start on a clean machine. So I compiled the following list of what should be in the installer:

- myapp.exe
- Qt5Core.dll, Qt5Gui.dll, Qt5Network.dll, Qt5Widgets.dll
- msvcp90.dll, msvcr90.dll, Microsoft.VC90.CRT.manifest
- platforms \ qwindows.dll

Having this set of files, you ensure your 100% runtime of your application everywhere and always.

PS For whom you need additional formats of graphic files or SQL drivers, as usual, you should also throw the corresponding DLLs into the imageformats or sqldrivers folders.

Source: https://habr.com/ru/post/164357/


All Articles