I'd like to use C++17 for my projects without always having to change it in the properties when starting a new one. Is this possible?
Thanks!
I'd like to use C++17 for my projects without always having to change it in the properties when starting a new one. Is this possible?
Thanks!
To change the defaults only for new projects, see How to change the default C++ template file?.
To change the defaults for all C++ projects, look for the following two .props
files in $(UserRootDir)
, usually C:\Users\<user name>\AppData\Local\Microsoft\MSBuild\v4.0
.
Microsoft.Cpp.Win32.user.props
Microsoft.Cpp.x64.user.props
Then insert the following under Project/ItemDefinitionGroup/ClCompile
.
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
If the .props
files did not exist and you had to create them from scratch, each one would have the following complete contents.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<ClCompile>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
</ItemDefinitionGroup>
</Project>
See my other answer here for more details about the property files, including where to find the per-machine defaults (in $(VCTargets)
), instead of the per-user ones (in $(UserRootDir)
).
Edit the property sheet under the View -> Other Windows -> Property Manager Next open the tree for a project and then the platform you wish to change.
The settings here are inherited by default for all project configurations of the corresponding platform so right click the node for "Microsoft.Cpp..User" and then go to C/C++ -> Language and set the language standard you want then click Ok.
You may need to right click the project node and select save, I'm not sure if that is actually necessary or not.