Why does a statically built Qt use the dynamic Visual Studio runtime libraries ? Do I need to deploy

本文解释了Qt为何使用动态链接的Visual Studio运行库进行静态编译,并强调了这种配置的原因是为了避免内存问题。同时说明了如何在特定情况下更改此设置,但警告这样做可能会遇到未支持的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://qt-project.org/faq/answer/why_does_a_statically_built_qt_use_the_dynamic_visual_studio_runtime_librar

 

Qt is built using the -MD(d) switch, which links against the dynamic C/C++ runtime libraries. This is necessary as we have experienced memory problems when using anything but the -MD(d) flag, and in general, it is recommended to use. You should not alter this flag yourself for your application, because it conflicts with how the Qt library is built if you change the flag to -MT. You should not change it for Qt either, since it is likely to cause problems.

Qt is still built statically when using the -static option though, meaning you do not need to distribute the Qt dlls when deploying your application. You will have to distribute the C runtimes though (if they don’t already exist on the target machine), see our deployment documentation [qt.nokia.com].

If you choose to change this setting anyway, then it can be done in the qmake.conf file for your qmakespec. Where it says -MD you need to change it to be -MT. For Visual Studio 2005 it is also necessary to change the relevant files in mkspecs/features to remove the call to mt.exe. As stated above, we can’t support you with any problems you run into as a consequence of making these changes.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值