我在 Windows 7 64 位上的 Visual Studio 2010 中编写了一个程序。 当我尝试在 Windows XP 32 位上运行它时,我收到消息称 msvcr100.dll 丢失。当我尝试将该文件从 Win7 复制到 WInXP 时,我收到一条消息,指出 msvcr100.dll 错误。 如何在VS中设置构建而不需要msvcr100.dll?
首先,您需要确保构建 32 位可执行文件 - 64 位可执行文件无法在 32 位 Windows 上运行。
那么您可以...
Project -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library
设置为
Multi-threaded (/MT)
。
另外不要忘记构建 32 位可执行文件。
致命错误 C1189:#error:请使用 /MD 开关进行 _AFXDLL 构建因此,为了帮助其他像我一样花了太多时间寻找明确解决方案的人,我想添加一些为我解决这个问题的信息。事实证明,我的项目使用上面的答案时使用了错误的“使用 MFC”设置。
说得更清楚一点:
打开项目属性(alt-F7 或项目菜单 -> [我的项目] 属性)并转到
Project -> Properties -> Configuration Properties
General -> Use of MFC
设置为
Use MFC in a Static Library
你必须设置
C/C++ -> Code Generation -> Runtime Library
Multi-threaded Debug (/MTd)
或
Multi-threaded (/MT)
如果
General -> Use of MFC
设置为
Use MFC in a Shared DLL
你必须设置
C/C++ -> Code Generation -> Runtime Library
Multi-threaded DLL (/MD)
或
Multi-threaded Debug DLL
我从 Microsoft 社区答案网站得到了这个答案,所有功劳都应归于 David Wilkinson。
https://www.microsoft.com/en-us/download/details.aspx?id=26999 (如果链接不再有效,请搜索“Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package MFC Security Update”)-> 选择 x86,而不是 x64,因为您需要 32 位 dll。
第 2 步。 现在在网站的搜索窗口中输入您的 DLL 错误。
步骤 3. DLL-Files.com 将立即列出包含该特定 DLL 文件的 zip 文件。将此 zip 文件下载到您的计算机上并解压。提取的文件夹将包含 DLL 错误文件。步骤 4. 复制下载的 DLL 文件(仅限该文件),然后根据您的操作系统将此文件粘贴到您的默认系统文件夹中。 C:Windows系统(Windows 95/98/Me) C:WINNT\System32 (Windows NT/2000) C:\Windows\System32(Windows XP、Vista、Windows 7/Windows 8.1/Windows 10)
Windows 会询问您是否要使用新的 DLL 文件替换现有的 DLL 文件。说“是”并让 Windows 复制该文件。重新启动计算机,瞧,您现在可以轻松运行未打开并给出 DLL 错误的游戏/应用程序。
还有许多其他网站可以为您提供您想要的 DLL 文件