1

I am using Visual Studio 2012 Ultimate, and want to manually set the language version to a previous version, Is this possible?

  • 6
    what is 4.8.1 ? GCC version? – AndersK Dec 01 '14 at 13:10
  • 1
    Sorry I meant the language version that precedes C++ 11 –  Dec 01 '14 at 13:14
  • I don't believe Visual C++ supports this (other than being able to use the C++ compiler from a previous version of Visual Studio, but not sure how far back that goes.). Also, Microsoft's support for C++ standards is generally phased across multiple versions. – crashmstr Dec 01 '14 at 13:16
  • 3
    BTW the C++ version preceding C++11 is C++03. C++ standards are: C++98, C++03, C++TR1 (2007), C++11. – Wojtek Surowka Dec 01 '14 at 13:20
  • @DracoM. You might have meant C++03? That's what I assumed in my answer. Here is the [list](http://en.wikipedia.org/wiki/C%2B%2B#Standardization) of versions [Wojtek Surowka](http://stackoverflow.com/users/2382136/wojtek-surowka) mentioned. Here is [Wikipedia's summary of C++03](http://en.wikipedia.org/wiki/C%2B%2B03). – Jonathan Mee Dec 01 '14 at 13:28
  • Why do you want to do such a thing? C++ standards are specifically designed so that programs written against a previous standard remain valid programs in the newest standard. If you need to compile a program that relies on compiler-specific/nonstandard behavior then you have no choice but to use exactly the compiler that it was designed to be used with, or fix the code to conform to the standard. – bcrist Dec 01 '14 at 13:41
  • 1
    @bcrist C++11 is not 100% compatible with C++03 code. Even for conform C++03 code. – MatthiasB Dec 01 '14 at 13:44
  • 1
    @bcrist Visual Studio 2012 has a lot of usability improvements over previous versions. It's nice to use the latest editor even if your code isn't compatible with the latest compiler. – Jonathan Mee Dec 01 '14 at 13:48
  • @MatthiasB True, but generally, well written C++03 code is valid C++11 code. – bcrist Dec 01 '14 at 13:54
  • 1
    @bcrist `int decltype = 0; int nullptr = 5` is well written C++03 code, but will result in compile errors in c++11, and [there are quite a few more](http://stackoverflow.com/questions/6399615/what-breaking-changes-are-introduced-in-c11). – MatthiasB Dec 01 '14 at 13:59
  • @JonathanMee Agreed, but that's not really what the OP asked. The wording of the question implies he wants to use the VC11 toolchain, but somehow magically have it parse C++98 or C++03 code. – bcrist Dec 01 '14 at 13:59
  • @DracoM. Perhaps you can adjust your question per [bcrist](http://stackoverflow.com/users/1571944/bcrist)'s point? – Jonathan Mee Dec 01 '14 at 14:02

1 Answers1

3

Sort of.

Microsoft sort of decides for itself what it will use in each version. For example Visual Studio 2010 was mostly a C++03 animal but you could use some C++11 features like auto.

Anyway the way you'd switch to Visual Studio 2010's compiler (or some other supported version) would be in your project's property pages: "Configuration Properties" > "General" > "Platform Toolset"
Then just pick the version you want to use.

Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288