简体   繁体   English

从Linux将Qt程序部署到Windows

[英]Deploy Qt program to Windows from Linux

I'm developing a Qt program on Linux which I would like to puplish on Windows too. 我正在Linux上开发Qt程序,我也想在Windows上使用它。 Compiling and static linking for Windows works well with MXE (qtbase installed) how ever I'd like to link my program dynamically. Windows的编译和静态链接与MXE(已安装qtbase)配合使用时,我想如何动态链接程序。

Dynamic linking works and the program runs under Wine but when I copy the EXE and the DLLs to Windows the program gives an error: 'This application failed to start because it could not find or load the Qt platform plugin "windows" in "".' 动态链接有效,并且该程序在Wine下运行,但是当我将EXE和DLL复制到Windows时,该程序给出了一个错误:“此应用程序无法启动,因为它无法在“”中找到或加载Qt平台插件“ windows”。 “

On Windows there's windeployqt that puts everything that the application needs to run neatly in one folder. 在Windows上,使用windeployqt将应用程序需要运行的所有内容都放在一个文件夹中。 Is there a way for getting this tool (or similar) running on Linux? 有没有办法让此工具(或类似工具)在Linux上运行?

You're missing several files needed around the executable. 您缺少可执行文件周围所需的几个文件。

Get them under "Qt Dir \\ Qt Version \\ MinGW Version \\ plugins \\" 在“ Qt Dir \\ Qt版本\\ MinGW版本\\插件\\”下获取它们

Required : 必填:

  • imageformats\\ imageformats \\
    • qgif.dll qgif.dll
    • qico.dll qico.dll
    • qjpeg.dll qjpeg.dll
    • qwbmp.dll qwbmp.dll
  • platforms\\ 平台\\
    • qwindows.dll (that's what the error is talking about) qwindows.dll(这就是错误所在)

(if in Debug mode, use these files with a "d" at the end, for example qwindowsd.dll) (如果处于“调试”模式,请在这些文件的末尾使用“ d”,例如qwindowsd.dll)

I'm not sure about the imageformats, but I had to use them even in programs not using pictures. 我不确定图像格式,但是即使在不使用图片的程序中也必须使用它们。 Try with "platforms\\qwindows.dll" first, then add the imageformats if the programs asks to. 首先尝试使用“ platforms \\ qwindows.dll”,然后根据程序要求添加图像格式。

See https://doc.qt.io/qt-5/windows-deployment.html for the full info and more precise options. 有关完整信息和更精确的选项,请参见https://doc.qt.io/qt-5/windows-deployment.html I'm just giving you the explanation. 我只是给你解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM