Search code examples
c++visual-studiocompilationc++17

How to enable C++17 compiling in Visual Studio?


I want to use C++17 features.

How can I switch compiling from C++14 to C++17 in Microsoft Visual Studio?

Or is it not available in release versions of VS?


Solution

  • There's now a drop down (at least since VS 2017.3.5) where you can specifically select C++17. The available options are (under project > Properties > C/C++ > Language > C++ Language Standard)

    • ISO C++14 Standard. msvc command line option: /std:c++14
    • ISO C++17 Standard. msvc command line option: /std:c++17

    Visual Studio 2022 (MSVC C++20 and the /std:c++20 Switch - C++ Team Blog):

    • ISO C++20 Standard. msvc command line option: /std:c++20

    Any Visual Studio:

    • The latest draft standard. msvc command line option: /std:c++latest