设为首页 收藏本站
查看: 942|回复: 0

[经验分享] Windows XP Targeting with C++ in Visual Studio 2012

[复制链接]

尚未签到

发表于 2015-11-4 10:15:03 | 显示全部楼层 |阅读模式
http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx

Background
In June, we announced enhanced targeting for Windows XP using the Visual Studio 2012 C++ compiler and libraries.This feature has been included in Visual Studio 2012 Update 1. You can download it from here. The purpose of this article is to provide an overview of theWindows XP targeting experience, the level of C++ runtime support, and noteworthy differences from the default experience shipped in Visual Studio 2012 at RTM.
Windows XP Targeting Experience
In order to target Windows XP, switch from the default v110 toolset to the newly introduced v110_xp toolset inside your project’s property pages. This new platform toolset points to a repackaged version of the Windows 7 SDK shipped in Visual Studio 2010 insteadof the Windows 8 SDK, but uses the same Visual Studio 2012 compiler. The v110_xp toolset also sets useful defaults such as a compatible linker subsystem version for downlevel targeting. Only executables built with this platform toolset are supported to runon Windows XP, but those same executables will also run on Vista, Windows 7 and Windows 8.
DSC0000.png
C++ Runtime Support
The static and dynamic link libraries for the CRT, ConCRT/PPL, STL, and MFC have been updated in-place to add runtime support for Windows XP and Windows Server 2003. Applications written in C++/CLI which target the .NET Framework 4.0 will also run on WindowsXP and Windows Server 2003. For these operating systems, the supported versions are Windows XP SP3 for x86, Windows XP SP2 for x64, and Windows Server 2003 SP2 for both x86 and x64.
[size=1em]Library
[size=1em]v110 (Vista+)

[size=1em]v110 (Store Apps)
[size=1em]v110_xp (XP/2k3+)

[size=1em]CRT
[size=1em]
X

[size=1em]
X

[size=1em]
X

[size=1em]ConCRT/PPL
[size=1em]
X

[size=1em]
X

[size=1em]
X

[size=1em]STL
[size=1em]
X

[size=1em]
X

[size=1em]
X

[size=1em]MFC
[size=1em]
X

[size=1em]

[size=1em]
X

[size=1em]ATL
[size=1em]
X

[size=1em]
X

[size=1em]
X

[size=1em]C++ AMP
[size=1em]
X

[size=1em]
X

[size=1em]

Differences from Vista+ Targeting

  • Building HLSL
    Building HLSL with the v110_xp toolset is not enabled by default. To enable HLSL compilation, download the DirectX SDK (June 2010) and set your project’sVC directories manually to point to this SDK, in a similar manner as Visual Studio 2010. For more information, see the “DirectX SDK Does Not Register Include/Library Paths with Visual Studio 2010” section of the DirectX SDK (June 2010) download page.
  • Debugging DirectX
    The Visual Studio 2012 Graphics Debugging experience is not supported when targeting DirectX 9.
  • Static Analysis
    When selecting the v110_xp platform toolset, the static analysis experience is disabled due to incompatibilities between the SAL annotations in the Visual Studio 2012 C++ libraries and the Windows 7 SDK. If static analysis is required, we recommendthat you switch the solution to the normal v110 toolset, execute static analysis, and then switch back to v110_xp.
  • Remote Debugging
    The Remote Tools for Visual Studio 2012 do not support remote debugging on an XP client. When debugging on Windows XP is required, it is recommended to usethe debuggers of an older version of Visual Studio, such as Visual Studio 2010, for local or remote debugging. This is in line with the Windows Vista experience for Visual Studio 2012 RTM, which is a runtime target but not a remote debugging target.
  • Process Status APIs
    As with Visual Studio 2012 RTM, applications that target Windows Vista and below while taking a dependency on theprocess status APIs must set  thePSAPI_VERSION macro to 1.
Targeting from the Command Line
Visual Studio 2012 solutions and projects which have been switched to the v110_xp toolset can be built from the commandline using MSBuild or DEVENV without additional steps.
However, if you wish to use CL and Link directly, additional steps are needed. Note that the steps below may be automated by creating a batch script.

  • Set the path and environment variables for Visual Studio 2012 command-line builds.
  • Set the required SDK paths and compiler flags using the following commands:

    set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
    set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
    set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
    set CL=/D_USING_V110_SDK71_;%CL%

    When targeting x64, set the lib path as follows:
    set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib\x64;%LIB%
  • Specify the correct subsystem and subsystem version for the linker based on the type of application you are building.Applications targeting the x86 version of Windows XP must specify subsystem version 5.01, and applications targeting x64 must specify version 5.02.

    For x86 console applications:
    set LINK=/SUBSYSTEM:CONSOLE,5.01 %LINK%

    For x64 console applications:
    set LINK=/SUBSYSTEM:CONSOLE,5.02 %LINK%
  • Execute CL and Link as you normally would within the command prompt.
Feedback
As always, we'd love to hear your feedback. Please submit bugs to Visual Studio Connect, and suggestions to VisualStudio UserVoice.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-134858-1-1.html 上篇帖子: VS 2012 for Windows Phone 8 中XAML格式设置 下篇帖子: windows7 更新布丁后 Visual studio2012闪退
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表