Is C++11 available in Visual Studio 2017?

前端 未结 4 1233
轮回少年
轮回少年 2020-12-16 14:04

I am currently using Visual Studio Community 2017. From looking at the C++ Language Standards in the project properties, they only provide C++14 and C++17. Since my code was

4条回答
  •  情话喂你
    2020-12-16 14:44

    The Visual C++ 2017 compiler is C++11/C++14 compliant with a few specific exceptions:

    • Expression SFINAE is implemented, but not complete.
    • Full C99 preprocessor support is limited due to some bugs with variadic macros
    • Two phase name lookup is in VS 2017 (15.3 update) but is incomplete and only active when using /permissive-

    The compiler does not offer a specific C++11 mode and defaults to C++14, but that standard is fully inclusive of C++11. C++17 support is in progress, and requires you use the /std:c++17 or /std::c++latest switch.

    std::stoi requires you include the appropriate header, specifically > Either you forgot to include that header -or- you didn't deal with the namespace resolution (either explicitly as std:: or via using namespace std;)

    See C++17 Features And STL Fixes In VS 2017 15.3 for the latest status of C++11/C++14/C++17 standards conformance as of the VS 2017 (15.3 update)

    UPDATED: Now that you have posted your code, I see that the problem has nothing to do with which standard is supported. Your problem is that you don't know the secrets of how Precompiled Headers work.

    Change:

    #include 
    #include "stdafx.h"
    

    to:

    #include "stdafx.h"
    #include 
    

    -or- add #include to the precompiled header stdafx.h directly.

    See Creating Precompiled Header Files

提交回复
热议问题