/Zc:__cplusplus (Enable updated
/Zc:__cplusplus compiler option enables the
__cplusplus preprocessor macro to report an updated value for recent C++ language standards support. By default, Visual Studio always returns the value
199711L for the
__cplusplus preprocessor macro.
__cplusplus preprocessor macro is commonly used to report support for a particular version of the C++ standard. Because a lot of existing code appears to depend on the value of this macro matching
199711L, the compiler doesn't change the value of the macro unless you explicitly opt in by using the
/Zc:__cplusplus compiler option. The
/Zc:__cplusplus option is available starting in Visual Studio 2017 version 15.7, and is off by default. In earlier versions of Visual Studio, and by default, or if
/Zc:__cplusplus- is specified, Visual Studio returns the value
199711L for the
__cplusplus preprocessor macro. The
/permissive- option doesn't enable
/Zc:__cplusplus option is enabled, the value reported by the
__cplusplus macro depends on the
/std version option setting. This table shows the possible values for the macro:
|Not specified||Any value||
The compiler doesn't support standards options for C++98, C++03, or C++11. The
/std:c++20 option is available starting in Visual Studio 2019 version 16.11. The value of
__cplusplus with the
/std:c++latest option depends on the version of Visual Studio. It's always at least one higher than the highest supported
__cplusplus standard value supported by your version of Visual Studio.
For finer-grained detection of changes to the compiler toolset, use the
_MSC_VER predefined macro. The value of this built-in macro is incremented for every toolset update in Visual Studio 2017 and later versions. The
_MSVC_LANG predefined macro reports the standard version whether the
/Zc:__cplusplus option is enabled or disabled. When
/Zc:__cplusplus is enabled,
__cplusplus has the same value as
To set this compiler option in Visual Studio
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.
Select the Configuration Properties > C/C++ > Command Line property page.
/Zc:__cplusplus-to the Additional options: pane.
Submit and view feedback for