【问题标题】:More efficient way to collect all DLL in a project收集项目中所有 DLL 的更有效方法
【发布时间】:2020-11-16 09:20:06
【问题描述】:

我想将可执行文件导出给其他人,他们可以通过单击玩游戏,但是当我单击可执行文件时,它立即关闭。我认为它错过了一些能够运行的 DLL 文件。所以我检查了构建日志。

'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\d3d11.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\D3DCompiler_47.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\dxgi.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\cryptsp.dll'. 
'Pacman.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'. 

.......等等。

是否只有一种方法可以手动复制上述所有文件?

Project Link

【问题讨论】:

  • 请参阅Determining Which DLLs to Redistribute 了解起点。
  • 如果它甚至不在构建它的计算机上运行,​​它就不会在其他任何地方运行。您需要先修复错误。

标签: c++ windows visual-studio-2019 directx-11 directxtk


【解决方案1】:

这些文件中的绝大多数只是 Windows 操作系统的一部分。

msvcp140.dll 是 Visual C++ 运行时的一部分。您可以并排部署这些(即 xcopy 样式部署)。见Microsoft Docs。如果您使用 Visual C++ 构建游戏,具体需要哪些文件取决于哪个版本。

  • vcruntime140.dll

  • msvcp140.dll

  • concrt140.dll(仅用于 Windows XP)

  • vccorlib140.dll(仅用于 C++/CX)

  • msvcp140_1.dll:(在 VS 2017 中添加)C++17 memory_resource

  • msvcp140_2.dll:(在 VS 2017 15.7 中添加)C++17 数学特殊函数

  • vcruntime140_1.dll:(在 VS 2019 中添加)__CxxFrameHandler4 for FH4(仅限 x64)

  • msvcp140_codecvt_ids.dll:(在 VS 2019 16.2 中添加)修复了 char8_tchar16_tchar32_t 的 codecvt。

D3DCompiler_47.dll HLSL 编译器取决于您的最低操作系统。 Windows 8.1 和 Windows 10 已经包含它。如果您需要支持 Windows 7 SP1 或 Windows 8.0,您可以将其与您的游戏并排包含。见this blog post

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-11
    • 2023-04-01
    • 1970-01-01
    • 2014-08-07
    • 1970-01-01
    相关资源
    最近更新 更多