Home > OS >  What is the latest C standard to target Windows XP with Visual Studio?
What is the latest C standard to target Windows XP with Visual Studio?

Time:11-09

Visual Studio 2019 seems to have good support for C 17. Unfortunately, it seems binaries built with it require the Universal CRT to be installed on the target machine, and the minimum supported OS for the UCRT is Vista.

So, if I want to build a binary to target Windows XP, must I use a VS C compiler preceding the UCRT? Is that VS 2013, which has some support for C 11?

CodePudding user response:

The latest toolset that has Windows XP support is v141_xp, that is the XP toolset from Visual Studio 2017. It has full C 14 support, and partial C 17 support. It comes with Visual Studio 2019, too:

VS 2019 installer with selected XP toolset

Unfortunately, it does not have full C 17 and C 20 support.

The latest update of VS2019 has almost complete C 20 support in v142 toolset, and there is an update expected to make it complete, but it is without XP support. (VS2022 is expected to drop Vista and support some C 23 in its v143 toolset).

The v141_xp toolset still has the support of C 14, and partial C 17. For example, static_assert(true); without string parameter compiles. I think it partially corresponds to the Conformance table where they mention VS 2017. (Say, you will have std::any, but won't be able to use shared_mutex, as it relies on Vista SRWLOCK)

See also: How to install build tools for v141_xp for VC 2017?

  • Related