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).

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:

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...

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 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.
Registered users can post here. Sign in or register to post.
  • 1007451581 2018-02-22
  • 8908121580 2018-02-22
  • 141161579 2018-02-22
  • 9421578 2018-02-22
  • 2826901577 2018-02-22
  • 3647361576 2018-02-22
  • 5717551575 2018-02-22
  • 523811574 2018-02-22
  • 6439871573 2018-02-22
  • 8109431572 2018-02-22
  • 8757321571 2018-02-22
  • 5265111570 2018-02-22
  • 3351351569 2018-02-22
  • 5109361568 2018-02-22
  • 4455391567 2018-02-22
  • 9091121566 2018-02-22
  • 24791565 2018-02-22
  • 2486841564 2018-02-21
  • 9847231563 2018-02-21
  • 9264681562 2018-02-21