Qt应用静态编译,静态链接,去mingwm10.dll,libgcc_s_dw2-1.dll依赖问题

本文介绍了如何解决Qt应用在Windows下依赖mingwm10.dll和libgcc_s_dw2-1.dll的问题,提供了使用静态版mingw和Qt编译的步骤,以及关于静态链接与动态链接的讨论。通过静态编译和特定配置,可以将Qt应用打包成仅包含一个exe文件,同时提到了MSVCRT.dll和kernel32.dll的处理以及LGPL版权问题。
摘要由CSDN通过智能技术生成

完全了解逻辑层次os/compiler/framework/application中静态链接、动态链接情况的,请绕道。
linux以及Xnux的大牛,也不用看了。

要想Qt应用做出来只是一个exe就能给客户运行,
有两个情况,搞定即可:

一、mingwm10.dll,libgcc_s_dw2-1.dll依赖

这与qt无关
用vc编译的就不存在……依赖这俩玩意的情况。

那么mingw版下的QT呢?
下载,静态版mingw(mingw本身和gcc都是static version)即可,见文末资源。

二、QtCoreX.dll QtXXX.dll等依赖

指定你的应用本身为静态编译即可。
1、project.pro添加QMAKE_LFLAGS=-static,
2、qt本身是静态版编译的,步骤见文末资源。
以上俩条件都需要,虽然qt静态版的,不用满足1即可,但是
逻辑上工程层次得指定,否则假设你是开源的,
别的兄弟拿过去编译,可能有些入行不久的会问为什么他的编译出来的不是一个文件了,呵呵。
而且你保不定自己就一直只有一套qt在跑,我就是静态动态版的都在用。

资源
--------------------------------------------------------------------------------

1、mingw静态编译版本:
有牛人http://code.google.com/p/qp-gcc/ 已经做好了,

Step 1 Open the zip-file you downloaded from DLL-files.com . Extract the DLL-file to a location on your computer. If you are unsure about how to extract your zip-file we recommend using File Viewer Plus 2. With it you can open your zip-file as well as over 300 other file formats (like video, music, images, pdf etc.) It’s a handy tool to keep around. After extracting your zip-file, place the extracted DLL-file in the directory of the program that is requesting the file. Make sure to use a 32bit DLL-file for a 32bit program, and a 64bit DLL-file for a 64bit program. Failure to do so will likely result in a 0xc000007b error. Step 2 If that does not help your problem, place the file to your system directory. By default, this is C:\Windows\System (Windows 95/98/Me), C:\WINNT\System32 (Windows NT/2000), or C:\Windows\System32 (Windows XP, Vista, 7, 8, 8.1, 10). On a 64bit version of Windows, the default folder for 32bit DLL-files is C:\Windows\System32\ , and for 64bit dll-files C:\Windows\SysWOW64\ . Make sure to overwrite any existing files (but make a backup copy of the original file). Reboot your computer. Step 3 If the problem still occurs, try the following to register the DLL-file: For 32bit DLL-files on a 32bit Windows, and for 64bit DLL-files on a 64bit Windows: Open an elevated command prompt. To do this, click Start, click All Programs, click Accessories, right-click "Command Prompt", and then click Run as administrator. In Windows 8/10, go to the Start screen. Start typing cmd and Windows will find "Command Prompt". Right click "Command Prompt" and choose "Run as administrator". If you are prompted for an administrator password or for a confirmation, type the password, or click Allow. Type regsvr32 "filename".dll and press Enter. Registering 32bit DLL-files on a 64bit Windows: Open an elevated command prompt, as instructed above. In the command prompt, start by typing following and press enter: cd c:\windows\syswow64\ th
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值