gpt4 book ai didi

visual-studio-2010 - 为什么qmake为vcapp模板选择 "Multi-threaded Debug DLL (/MDd)"运行时库?

转载 作者:行者123 更新时间:2023-12-04 16:49:37 25 4
gpt4 key购买 nike

我有以下 qmake 项目文件(test.pro):

CONFIG += debug
TEMPLATE = vcapp

SOURCES = temp.cc

我在 cygwin shell 中使用以下命令运行 qmake:

env QMAKESPEC=${QT_ROOT}/mkspecs/win32-msvc2010 ${QT_ROOT}/bin/qmake.exe -o test.vcxproj test.pro

我在 Visual Studio 2010 中打开 .vcxproj 文件并查看“运行时库”的值。它被设置为多线程调试 DLL (/MDd)。那是一个惊喜。不是应该设置成多线程调试(/MTd)吗?毕竟,我的模板是vcapp,而不是vclib

我是否需要更改一些其他设置来指示 qmake 生成使用多线程调试 (/MTd) 的 .vcxproj 文件?

感谢您的见解。

最佳答案

感谢 Hans Passant 提供链接。

来自 https://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.

关于visual-studio-2010 - 为什么qmake为vcapp模板选择 "Multi-threaded Debug DLL (/MDd)"运行时库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25491916/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com