有没有办法在 VS 2019 中将 C++ 可执行文件与 DLL 合并?

Is there a way to merge C++ executable with DLL's in VS 2019?

我最近想在另一台计算机上尝试我的 C++ 程序(用 VS 2019 社区版编写),但出现一些错误,缺少一些 DLL。有什么方法可以将这些 DLL 与 C++ 可执行文件(VCRUNTIME140D.dll 等)合并。

涵盖了 Visual C++ 程序的部署 here

您可以“并排”部署所需的 运行time 文件,将它们仅包含在您的程序设置、zip 文件等中。您可以在这里找到它们:C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Redist\MSVC.29.30133\<arch>\Microsoft.VC142.CRT

Statically linking the CRT is supported, but it is not recommended. Really the only time it makes sense to use the static CRT is if you are building a setup program/bootstrapper. As noted, redistributing the debug version is restricted as it's only intended for testing and development, not "retail" release.

或者,您可以告诉用户自行下载和 运行 Visual C++ 2019 redist 包:

X86(32 位)应用程序 - https://aka.ms/vs/16/release/VC_redist.x86.exe
X64 本机应用程序 - https://aka.ms/vs/16/release/VC_redist.x64.exe
ARM64 本机应用程序 - https://aka.ms/vs/16/release/VC_redist.arm64.exe