c++ - Qt发布程序出错
黄舟
黄舟 2017-04-17 14:01:03
0
3
565

一、问题点:我在Qt5.3.1上开发完一个应用程序后,在开发机上运行良好,当我部署到其他机器时(release版本发布)弹出如下图错误后崩溃:

二、已采取应对措施
1、复制所需的*.dll(Qt5Core.dll...)到应用程序同一目录;
2、复制platforms目录到应用程序同一目录;
3、复制libEGL.dll,libGLESv2.dll,D3DCompiler_43.dll到应用程序同一目录。

三、应用程序机构图

注:图中hellworld.exe为测试程序,能正常运行,crm.exe为发布程序不能正常运行。

四、寻求帮助
请问还有哪些可能的因素会造成此问题,分别有哪些解决办法,谢谢不吝指教!

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
巴扎黑

I can’t see your image either, it’s always loading. Regarding Qt development, I would like to say briefly,

Qt development version selection

The version number of Qt is usually three digits. It is recommended to choose the larger version when choosing a version. For example: 4.8.0, 5.0.0, 5.3.0, 5.7.0...the last number should be 0 as much as possible. Such a version is more stable than other non-zero numbers at the end. The topic 5.3.1 was chosen by the author. Personally, I don’t feel very good about it, but this time your problem is not there.

Release of Qt win application

I have tested the following method and think it is more convenient and feasible. If it does not work, please refer to other people's solutions.
In fact, publishing Qt applications is very simple. With such a good framework, Qt must have considered how to publish programs conveniently.

Digression

Qt is written once and compiled and released in multiple places, realizing its cross-platform nature. Except for some special libraries, almost all different platforms use Qt libraries. Published programs cannot run, most of which are caused by incomplete libraries. Since the Qt environment path has been configured on the development machine, there will be no error if you run it directly in the folder. But a pure machine is prone to errors. Most of them are missing Qt library files.

windeployqt

This is an official small program that comes with Qt. As you can see from the name, win deploy (publish) qt.

How to use

1. Release your program;
2. Enter the release folder and delete all except executable programs. It is useless
3. Under win, hold down the shift key and use the mouse Right-click and select to open the command window here
4. Configure the Qt environment path first. Just type windeployqt my.exe and press Enter
5. Check your release file. There are many more files. Copy the entire folder to a clean machine and the program will run perfectly;
5. After the above steps, you can still If it doesn't work, please check rp.

刘奇

I don’t know if it’s due to my network or SF itself, but I can’t see your pictures at the moment (infinite loading).
If publishing under Windows, according to "QT +=" in your .pro project file, all related dlls in this line must be copied.
For exampleQT += core gui network opengl widgetsneed to copy:

Qt5Core.dll
Qt5Gui.dll
Qt5Network.dll
Qt5OpenGL.dll
Qt5Widgets.dll
libEGL*.dll #This is OpenGL dependent, you can do it without OpenGL Ignore.

Then, depending on your compiler (MSVC or MinGW), you also need to copy the relevant dlls. The specific dependent dlls can be viewed using the Dependency Walker software.
Finally is the Windows directory of the platform, maybe only qwindows.dll is needed.
Put the dlls one by one into the same directory of the program and check slowly.

大家讲道理

In addition to windeployqt mentioned above, you can also use [dependency walker] to view the dll dependencies of the generated exe, and then copy all dlls.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template