- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我读到this article , 下载最新的 MSVS 2022 就足够了然后安装工具集 C++ Windows XP Support for VS 2017 (v141) tools [Deprecated]
。
之后,我在 Visual Studio 的项目属性中设置了这个工具集。根据链接文章,编译支持 XP 的 C++ 应用程序就足够了。
但是在创建我的 .exe
文件后,如果我在 XP 64 位 SP2 上运行它,它会显示错误,即 KERNEL32 中找不到
.CompareStringEx
函数.DLL
因此看来仅使用此工具集是不够的。还需要其他东西。
在其他一些地方,我看到还需要在编译时添加 define /D_USING_V110_SDK71_
,在链接时添加选项 /SUBSYSTEM:CONSOLE,5.01
。在我的项目属性中,我也尝试添加这两个选项,但 CompareStringEx
仍然在最终应用程序的导入表中。
作为suggested @BenVoigt,我确实定义了 /DWINVER=0x0502/D_WIN32_WINNT=0x0502
。还将 C++ 标准设置为 /std:c++14
(我会设置 C++11,但此 MSVS 版本至少允许设置 C++14)。仍然有一些非 XP 符号保留在最终的 EXE 中,例如 InitializeSRWLock这可能被 C++11 的 std::mutex 使用在我的代码中。
有人知道编译完全兼容 XP 的应用程序所需的一切吗?
更新。通过执行上述操作以及将 C++ CRT 运行时设置为 Multi Threaded DLL
,即使用 CRT 的动态 DLL 链接,我设法构建了有效的 XP 应用程序。也为 suggested通过@ChuckWalbourn(向下 x86 或 x64 redists),我下载了旧版本的 msvcp140.dll
。
但对于我的项目来说,拥有静态链接的运行时 (C++ CRT) 非常重要,即在项目属性的运行时字段中使用 Multi Threaded
值。只有当它真的不可能时,我才会使用 DLL CRT。在此之前,欢迎使用有关如何静态链接 CRT 的解决方案,当然可以生成与 XP 兼容的 EXE。
最佳答案
TL;DR 对于 Window XP VC++ REDIST 支持,安装 https://aka.ms/vs/15/release/VC_redist.x86.exe在您的 Windows XP 系统上
-或-
如果您正在执行“并行应用程序本地部署”,则使用来自 C:\Program Files\Microsoft Visual Studio\2022\<edition>\VC\Redist\MSVC\14.16.27012\x86\Microsoft.VC141.CRT
的 DLL。 .
If you want the latest bug fixes to the CRT, you can also download the REDIST for VS 2019 (16.7) per the link on Microsoft Docs.
对于 Windows XP 目标,您使用 v141_xp
Visual Studio(VS 2017、VS 2019 或 VS 2022)安装的平台工具集是最新的 VS 2017 (v141
) C++ 编译器,使用随附的 Windows 7.1A SDK。
确保您已安装(对于 VS 2022)以下各个组件,因为您使用的是 MFC:
Microsoft.VisualStudio.Component.WinXP
: C++ Windows XP 支持 VS 2017 (v141) 工具 [已弃用]Microsoft.VisualStudio.Component.VC.v141.x86.x64
: MSVC v141 - VS 2017 C++ x64/x86 构建工具 (v14.16)Microsoft.VisualStudio.Component.VC.v141.MFC
: 用于 v141 构建工具(x86 和 x64)的 C++ MFCIf you are doing DirectX development, be sure to read this blog post as well for various implications of using the Windows 7.1A SDK.
要部署到 Windows XP,您可以安装最新的 VS 2017 Visual C++ REDIST 或使用 VS 2019 Visual C++ 到 VS 2019 (16.7)。此后,REDIST DLL 本身与 Windows XP 不兼容。
在安装了 VS 2022 的开发系统上,您将拥有一组更新的 Visual C++ REDIST 文件,这些文件是 binary compatible用你的v141_xp
Platform Toolset 构建了 EXE,但那些 VC++ REDIST DLL 不与 Windows XP 兼容。
IOW: If you look at a
dumpbin /imports
of the 14.30 (v143 version), 14.29 (v142 latest version), and/or 14.16 (v141 latest version ) copies ofmsvcp140.dll
you will see different imports. Themsvcp140.dll
sitting in yourC:\windows\SysWOW64
folder is going to be the 14.30 version.
关于c++ - 如何在 MSVS 中为 Windows XP 编译 C++ 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70263892/
问题是不言自明的。如果重要的话,我正在为 USB 驱动器命名。 谢谢。 最佳答案 32 characters in NTFS, 11 in FAT. 关于windows-xp - Windows XP
我在我的 macbook(lion os)上使用并行桌面,我想让 xampp/localhost 在我安装的 XP 版本上工作,这样我就可以在 Internet Explorer 中测试我的网站。 显
我将如何创建自己的 XP 打印机驱动程序,它将执行以下操作: 打印到文件(可能是 XPS 格式) 将此文件放入密码 protected ZIP 文件 将 zip 文件通过电子邮件发送到已配置的 电子邮
我记得看过 Mark Russinovich 的网络广播,显示了用户启动的内核转储的键盘按键序列。有人可以按键的确切顺序刷新我的内存。 请注意,这是针对 XP 的。 最佳答案 http://psaca
我父亲找到了一个他非常喜欢的俄语键盘映射here .但是,它是非标准的,因此不会出现在键盘布局选择的语言(控制面板->区域和语言选项->语言->详细信息->文本服务和输入语言->添加)下拉列表中。据我
我想将 Chocolatey 与某些 Windows XP VM 一起使用。不幸的是,Chocolatey 要求告诉我们至少需要 Windows 7。( https://chocolatey.org/
是否有官方的 Windows XP 注册表引用在线某处?我看到 Win 2000 有一个引用和 Win 2003 MS technet 上的服务器,但我似乎找不到适用于 XP 的服务器。是的,我知道
我有一个带有第三方应用程序的四核系统,偶尔会旋转多个进程(始终是相同的可执行文件,但有多个实例)并占用 100% 的 CPU 时间。我还在同一个机器上运行了几个 Web 服务(IIS 和第三方)。 所
我正在寻找“RunOnceEx”的反向版本。 RunOnceEx 确实在用户的 shell(桌面和任务栏)启动之前运行一些程序。在 runonceex 完成之前,登录进度不会继续。 我想做完全相同的事
我有一个程序,我试图在两台计算机上运行。在一台电脑上,它工作正常。但是,在另一台计算机上,它在尝试创建 USB channel 时挂起。我没有能力查看程序内部。确定两台机器之间差异的最佳方法是什么?
Windows XP 绘制带有漂亮阴影的图标文本,这有助于阅读各种背景上的文本。字体颜色为白色,阴影为黑色(如果桌面背景为白色)或根本没有阴影(如果桌面背景为黑色)。 所以有两个子任务: 阴影是如何绘
有没有办法通过批处理脚本在 Windows XP 中创建用户,甚至为其分配管理员/受限用户值? 最佳答案 假设用户名是 rased 密码是 pAsS net user rased pAsS /add
我正在寻找使用 SP2 或 winsock 在 XP 上访问 A2DP、AVRCP、MAP、HFP 等蓝牙配置文件的供应商独立方式。 我正在最终确定为蓝牙创建应用程序的方法。 除了服务发现之外,我还需
我想通过 Windows 代码包将 Direct2D 用于我的 .Net 应用程序。由于我的一些用户使用 XP,我需要提供 GDI+ 后备。我想知道人们通常如何进行这种后备。 他们是否将所有必要的图形
根据 Microsoft 文档,直到 Windows Vista,InterlockedCompareExchange64 才可用作 Windows API 调用。见 http://msdn.micr
计算机管理 -> 服务和应用程序 -> 消息队列 如何从特定队列中删除消息? 在我看来有一些方法,但我现在找不到。 最佳答案 嗯,不可能通过 MMC 删除有害消息。 你可以试试QueueExplore
Windows XP 中存储的用户帐户图标/图片在哪里? (显示在非经典登录屏幕和开始菜单上的那些。) 最佳答案 C:\Document and Settings\All Users\Applicat
在 WinXP 上安装时,出现以下错误 在 Win7 应用程序上安装没有问题。 Windows 窗体应用程序和 WPF 应用程序都存在相同的问题,并且在 VS 2010 之前它们都可以正常工作。 最佳
是否可以在 Windows XP 上的 Visual Studio 中使用/引用 Microsoft.Web.Administration?我知道,在 XP 上安装 IIS 7 是不可能的,但我(必须
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我是一名优秀的程序员,十分优秀!