3

I've made a <sarcasm>shocking</sarcasam> discovery: Visual Studio 2015 is not C++11 compliant by default

I can follow the steps I listed here for each project, or use Notepad++ or similar to do a files replace, but I do notice that the "Command Line" Properties have a checkbox: "Inherit from parent or project defaults"

enter image description here

Is there a way to add "/Zc:rvalueCast" to my "project defaults" so everything will use it, including future projects?

Community
  • 1
  • 1
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
  • wow Well done. I have confirmed this to be true and MSVS 2017 doesn't have that enabled by default... Would you still recommend I enable this? – KeyC0de Sep 29 '18 at 22:39
  • 1
    @Nik-Lz My recommendation would be to set this flag as it makes Visual C++ standard compliant in this regard. – Jonathan Mee Sep 30 '18 at 19:10
  • 1
    Yes, definitely. It broke a large project of mine, but thankfully the damage was minor and I just managed to fix it. – KeyC0de Sep 30 '18 at 19:14
  • 1
    I found out that starting with MSVS 2017 the `/permissive` option which is enabled by default automatically enables `/Zc:rvalueCast` and another option which makes compilation standard conforming. Therefore if you're compiling through the IDE this is no longer an issue. I didn't notice this before, but I did now so I've come to report it. – KeyC0de Oct 06 '18 at 12:02
  • @Nik-Lz Thank you so much for the update. Sadly I haven't had the opportunity to test the newer versions of Visual Studio at work :( – Jonathan Mee Oct 07 '18 at 21:14

1 Answers1

4

Edit the microsoft.cpp.win32.user property sheet accordingly.

To access it, open the property manager for your solution. (It's sometimes tricky to find the property manager - see this question) Then, in the Property Manager, drill down, until you find the user property sheet as shown below. Then right-click and select Properties and edit any settings you like. After you're done, don't forget to save the property sheet (Right-click and select save)

enter image description here

Community
  • 1
  • 1
zdan
  • 28,667
  • 7
  • 60
  • 71
  • So it seems like the "Release" Properties inherit from the "Debug" ones, but it looks like I will need to also edit "Debug | x64" > "Microsoft.Cpp.x64.user" right? – Jonathan Mee Jun 23 '16 at 11:24
  • @JonathanMee Yup. You could also create your own property sheet (like the Common_DefaultPropertySheet in my screenshot). It gives you more control, but you have to remember to include it in your projects – zdan Jun 23 '16 at 20:32