Is it possible to disable C++11 features on VS2012? My code isn't ready for that yet and I'd like not to introduce further confusion
-
Does the approach mentioned [here](http://stackoverflow.com/a/3536297/519383) in the comment help (i.e. using VS2008 compiler through VS2012)? – juan.facorro Jul 19 '13 at 17:43
-
I would also like to know if it's possible on VS2010, sorry to hijack. – Twifty Jul 19 '13 at 17:43
-
http://stackoverflow.com/questions/3536029/disabling-c0x-features-in-vc-2010 – Sadeq Jul 19 '13 at 17:44
-
You are at least two years late then – Bartek Banachewicz Jul 19 '13 at 17:48
-
6If your code "isn't ready for that" then it must be a serious hack. There's a legitimate need to get warned about use of C++11, if the code needs to also compile on other compilers. But disabling C++11? No need. – Ben Voigt Jul 19 '13 at 17:54
-
Actually a rather good question could be: "How to specify C++ compatibility level for Microsoft C++ compiler" – Csaba Toth Jul 19 '13 at 18:53
-
I cannot find the answer so I opened this: http://stackoverflow.com/questions/17753568/is-there-a-way-to-specify-c-compatibility-level-for-microsoft-c-compiler – Csaba Toth Jul 19 '13 at 18:59
3 Answers
Right click the project -> Properties -> General -> Platform Toolset -> Visual Studio 2010
This will compile the project with the Visual Studio 2010 compiler.

- 9,483
- 8
- 40
- 66
-
4
-
1and you need to have the compiler of VS'10 setup on your system. It'snt include with VS'12 – alexbuisson Jul 19 '13 at 17:54
-
-
@Caesar I think I'm gonna have to throw in the towel and upgrade. I just hope the VS2010 annoyances have been fixed. – Twifty Jul 19 '13 at 18:08
-
1What beats me is why, as the compiler gets better and better and the IDE gets more and more bloat, they give you an option to combine the worst of both -- new IDE+old compiler -- and not the other way around. Or has someone written a targetting pack for VC++ 2010 to run the 2012 compiler? – Ben Voigt Jul 19 '13 at 18:51
-
@BenVoigt I'm not saying that it is the greatest thing in the world, I'm saying it is option to the question. – Caesar Jul 19 '13 at 19:13
-
While this is a bit off topic for the question it is useful to know this option as some projects on Visual Studio 2012 may have this toggled and confuse users of why they cant use c++ 11 features. – marsh May 14 '15 at 14:39
As of Visual C++ 2015 Update 3, it is now possible to specify a language version for language behavior (apparently it doesn't affect just conformance checking):
https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in-the-compiler/
Unfortunately the only options are "C++14" (not exact, it includes post-C++14 features which had previously shipped) and "C++ Latest" (C++14 plus partial implementation of C++17 and proposals, but not "experimental" features)
The corresponding command line switches are:
/std:c++14
/std:c++latest

- 277,958
- 43
- 419
- 720
Yes, you can disable C++11 features on the Visual C++ compiler. The /Tc
compiler option will cause errors for C++11 syntax.
Unfortunately, C++03 and C++98 will be collateral damage. All that is left will be C89, plus a few Microsoft extensions like support for //single line comments
.

- 277,958
- 43
- 419
- 720
-
4I think it's important to clarify more that Tc will downgrade to C. It's not just you loose some C++, but you loose C++ all together. – Csaba Toth Jul 19 '13 at 18:29
-
@Csaba: Yes, that's right. Did my second paragraph mean something else to you? – Ben Voigt Jul 19 '13 at 18:32
-
1@JohnDibling: Probably because I didn't answer the question the OP obviously meant. But I don't think "how can I run Visual C++ 2012 in C++03 mode?" has any answer. – Ben Voigt Jul 19 '13 at 18:50
-
@BenVoigt I didn't downvote. I admit, that "All that is left will be C89" does say that you left with C only. But some people might overlook that. – Csaba Toth Jul 19 '13 at 18:51
-
2Wording such as "Yes, you can disable C++11 features, but only by disabling *all* C++ features" may have avoided the down-votes. But, I like it like it is.... :) – Tony Delroy Jul 01 '14 at 06:39