setting c++ std to c++98 ?

I tried changing the c++ version to c++98 on the msvc compiler
by using the /std:c++98 option

but it said it was unrecognized ?
i also tried setting it to c++11 but the same thing happened.

It works fine when i set it to c++14, though.

Is this because the compiler simply don't support c++98 ?
or does the newer versions of visual studio just not come with older versions of the standard ?

Last edited on
/std: only works for c++14 or c++latest (and c++17 in latest VS2017).
https://msdn.microsoft.com/en-us/library/mt490614.aspx

As far as I know, Microsoft never allowed switches like c++11, it just gradually added more C++0x (which became c++11) features to its compiler, without having the option of turning them off.

quote from December 2013:
https://social.msdn.microsoft.com/Forums/en-US/8c2797a2-64d8-42fc-bb1a-33e8e6209989/visual-studio-supporting-c11how-to-enable-c11?forum=vcgeneral

You don't have to do anything special to enable [C++11] features.
Marked as answer by Jane Wang - MSFTMicrosoft contingent staff


_______________________________________

The solution on StackOverflow seems to be that you simply have to use an earlier toolset...
https://stackoverflow.com/questions/30371985/change-use-older-c-version-in-visual-studio

To completely disable C++11 features in Visual Studio, you must compile with a toolset old enough that it does not have any C++11 features. The last version of Visual Studio to have no C++11 support was VS2008 (question about that here: Visual Studio 2008 with c++11).

To use an older toolset, you must first install that version of Visual Studio, and then modify the "Configuration Properties->General->Platform Toolset" and set it to the appropriate Visual Studio version. When you compile with Visual Studio 2008 toolset, any C++11 usage will be errors.
Last edited on
What version of the compiler are you using? The /std:c++14 option was added to the VS 2015 with update 3. To allow you to stick with the C++14 standard while they modify their compiler to support the upcoming C++17 standard.

Normally VS doesn't support going backwards to get something like strict C++98 support. If you want something to compile to C++98 you would need to download a compiler that doesn't yet support C++11 features, VS 2008. You'll have the same problems if you need to support strict C++11, you'll need to find a compiler that doesn't support any C++14 features, good luck on this. The different versions of the compiler will support different features of the standards and finding one with all of the C++11 features without any C++14 features may not be possible.

You need to realize that when a new standard is released the older standard is depreciated. So as of now the current C++ standard is C++14, with C++17 in the final release stages. It should get final approval before the end of the year (hopefully).
you'll need to find a compiler that doesn't support any C++14 features, good luck on this.

Indeed, I don't think having full C++11 support without any C++14 features is possible for Microsoft compilers.
Comparing the C++11 and C++14 features in http://en.cppreference.com/w/cpp/compiler_support supports this claim. (18.0 seems to be closest you'll get to full C++11 support without going over, but that leaves out things like constexpr)

A company that wants a strict policy would need to use the /std:c++14 switch... or just make sure all employees are using a close-enough compiler version and have a proper build system.
Topic archived. No new replies allowed.