Search code examples
c++visual-studiostandards

Why is the Visual Studio Community 2017 C++ standard C++98?


Yesterday I upgraded to the latest VS Community 2017 (the previous one was installed last year) and wanted to check the C++ standard. So I run the following code that checks it, and as it turns out, I have C++98:

#include<iostream>
using namespace std;
int main()
{
    cout << __cplusplus << endl;
    system("pause");
}

Which outputs

199711

Why don't I have the latest C++ standard?

screenshot of the code, output and vs version


Solution

  • The value of __cplusplus is temporarily intentionally non-conformant by default for current versions of Visual Studio in order to avoid breaking existing code. It does not mean your compiler does not support any C++11 (or newer) features.

    Quoting from MSVC now correctly reports __cplusplus:

    /Zc:__cplusplus

    You need to compile with the /Zc:__cplusplus switch to see the updated value of the __cplusplus macro. We tried updating the macro by default and discovered that a lot of code doesn’t compile correctly when we change the value of __cplusplus. We’ll continue to require use of the /Zc:__cplusplus switch for all minor versions of MSVC in the 19.xx family.