What's new for C++ in Visual Studio 2022

Visual Studio 2022 brings many updates and fixes to the Microsoft C++ environment. We've added features and fixed many bugs and issues in the compiler and tools. The Visual Studio IDE also offers significant improvements in performance and productivity, and now runs natively as a 64-bit application. For more information on what's new in all of Visual Studio, visit What's new in Visual Studio 2022. For information about what's new in the C++ docs, see Microsoft C++ docs: What's new.

What's new for C++ in Visual Studio version 17.3

For a summary of new features and bug fixes in Visual Studio in version 17.3, see Visual Studio 2022 version 17.3 Release Notes.

  • The Arm64EC toolchain is no longer marked as experimental and is ready for production use.

  • The Visual Studio Terminal can now be used as an SSH client with your stored SSH connections. With the C++ for Linux Tools installed, open the Terminal tool window. The Terminal dropdown is populated with your stored connections. When you select a connection, a new Terminal window opens inside Visual Studio that shows a pseudo-terminal on your remote system. Control characters, colors, and cursor positional awareness are all supported.

  • Visual Studio can now add Unreal Engine class templates for your UE projects. To try this feature, ensure IDE support for Unreal Engine is selected in the Game development with C++ workload in the Visual Studio Installer. When you're working on a UE project, right-click in the project or a folder/filter and select Add > UE Class.

  • Go to Definition now remembers the prior signature and navigates accordingly when a better match isn't available (for example, after you manually change the signature of one of the pair). We've improved responsiveness of Go To All. Previously, results appeared after you stopped typing. In the new experience, results show as you type.

  • In contexts requiring enum type completion (for example, assignments to enum variables, case labels, returning enum type, and so on), the autocompletion list is now filtered to just the matching enumerators and related constructs.

  • Added NuGet PackageReference support for C++/CLI MSBuild projects targeting .NET Core. This change was made to unblock mixed codebases from being able to adopt .NET Core. This support doesn't work for other C++ project types or any C++ project types targeting .NET Framework. There are no plans to extend PackageReference support to other C++ scenarios. The team is working on separate experiences involving vcpkg, which will work for non-MSBuild scenarios and add greater functionality.

  • Added a Serial Monitor window for embedded development, available through Debug > Windows > Serial Monitor.

  • Improved C++ indexing by ~66% compared to 17.2.

  • Updated the version of CMake shipped with Visual Studio to version 3.23. See the CMake 3.23 release notes for details of what is available.

  • Upgraded the versions of LLVM tools shipped with Visual Studio to v14. For details of what is available, see the LLVM and Clang release notes.

  • Updated the side-by-side Dev 16.11 C++ Toolset to version 14.29.30145.00. The latest version of the Dev 16.11 C++ Toolset contains important bug fixes, including fixing all remaining C++20 defect reports. For more information about bug fixes, including C++20 defect reports in Dev 16.11, see Visual Studio 2019 version 16.11.14 release notes.

  • We have made various improvements to the in-editor experience of C++ modules. We're continuously working on improving the quality of the experience but encourage you to try them in 17.3. Report remaining issues through Developer Community.

What's new for C++ in Visual Studio version 17.2

For a summary of new features and bug fixes in Visual Studio in version 17.2, see Visual Studio 2022 version 17.1 Release Notes.

  • Added compiler support for C++23 feature deducing this, available under the /std:c++latest option.

  • Added IntelliSense support for C++23 features deducing this and if consteval.

  • Added inline parameter name and type hint support, toggled by pressing Alt+F1 or double-tapping Ctrl. This behavior can be customized under Tools > Options > Text Editors > C/C++ > IntelliSense.

  • Added experimental support for C++20 modules in CMake projects. This support is currently only available with the Visual Studio (MSBuild) generator.

  • In 17.1, we introduced peripheral register and RTOS views for embedded developers. We continue to improve the capabilities of those views with usability improvements in 17.2:

    • The RTOS tool window is now hidden by default. It prevents showing a tool window with error messages that aren't relevant when you're not using an RTOS.
    • When you choose (double-click) an RTOS object in the tool window, it adds a watch for the object.
    • When you select the start and end values for the stack pointer in the RTOS tool window, it's opened in the memory window.
    • We've added thread awareness for device targets to the call stack window.
    • Users can now select a pin icon next to peripherals, registers, or fields to pin them the top of the Peripheral View.
  • We've added implementations of the remaining C++20 defect reports (also known as backports). All C++20 features are now available under the /std:c++20 option. For more information about the implemented backports, see the C++20 Defect Reports project in the Microsoft/STL GitHub repository and the MSVC's STL Completes /std:c++20 blog post.

  • We added various C++23 Library features, available under the /std:c++latest option. For more information about the new features, see the STL Repo changelog.

  • Improved performance of the initial C++ indexing by up to 20%, depending on the depth of the include graph.

What's new for C++ in Visual Studio version 17.1

For a summary of new features and bug fixes in Visual Studio in version 7., see Visual Studio 2022 version 17.1 Release Notes.

  • A new Configure Preset template has been added to configure and build CMake projects on a remote macOS system with CMakePresets.json. You can also launch CMake targets on a remote macOS system, and then debug remotely in the Visual Studio debugger backed by GDB or LLDB.

  • You can now debug core dumps on a remote macOS system from Visual Studio with LLDB or GDB.

  • The versions of Clang and LLVM shipped with Visual Studio have been upgraded to v13.

  • Visual Studio's CMake integration is only active when a CMakeLists.txt is identified at the root of the open workspace. If a CMakeLists.txt is identified at another level of the workspace, then you'll be prompted to activate Visual Studio's CMake integration with a notification.

  • Added a new register visualization window for embedded targets, available through Debug > Windows > Embedded Registers.

  • Added a new thread view for RTOS projects, available through Debug > Windows > RTOS Objects.

What's new for C++ in Visual Studio version 17.0

For a summary of new features and bug fixes in Visual Studio, see Visual Studio 2022 version 17.0 Release Notes.

  • The Visual Studio IDE, devenv.exe, is now a native 64-bit application.

  • The MSVC toolset now defaults to SHA-256 source hashing in debug records. Previously, the toolset used MD5 for source hashing by default.

  • The v143 build tools are now available through the Visual Studio installer and in the standalone build tools.

Hot Reload for native C++

  • Hot Reload for C++ makes it possible to make many types of code edits to your running app and apply them without needing to pause app execution with something like a breakpoint.

In Visual Studio 2022, when you start your app in the debugger, you can use the Hot Reload button to modify your application while it's still running. This experience is powered by native Edit and Continue. For more information about supported edits, see Edit and Continue (C++).

  • Hot Reload supports CMake and Open Folder projects.

WSL2 support

  • You can now build and debug natively on WSL2 without establishing an SSH connection. Both cross-platform CMake projects and MSBuild-based Linux projects are supported.

Improved CMake support

  • We've upgraded the version of CMake shipped with Visual Studio to version 3.21. For more information on what's available in this version, see the CMake 3.21 release notes.

  • CMake Overview Pages have been updated to support CMakePresets.json.

  • You can now configure and build your CMake projects with CMake 3.21 and CMakePresets.json v3.

  • Visual Studio now supports the buildPresets.targets option in CMakePresets.json. This option allows you to build a subset of targets in your CMake project.

  • The Project menu in CMake projects has been streamlined and exposes options to "Delete Cache and Reconfigure" and "View Cache".

  • Implemented the /scanDependencies compiler option to list C++20 module dependencies for CMake projects, as described in P1689R4. It's a step towards support for building modules-based projects with CMake and we're working on completing this support in later releases.

Standard Library improvements

Select Standard Library (STL) improvements are highlighted here. For a comprehensive list of new functionality, changes, bug fixes, and performance improvements, see the STL team's Changelog.

  • Added debugging visualizers to improve how the following types are displayed: source_location, bind_front(), u8string (and its iterators), default_sentinel_t, unreachable_sentinel_t, ranges::empty_view, ranges::single_view, ranges::iota_view (and its iterator/sentinel), ranges::ref_view, thread, thread::id, jthread, and filesystem::path
  • Added [[nodiscard]] to the stoi() family of functions in <string> and to various functions in <locale> such as the collate member functions, has_facet(), and the isalnum() and tolower() families.
  • P0980R1 Made std::string constexpr in VS 2019 16.10. Now it's also supported for Clang.
  • P1004R2 Made std::vector constexprin VS 2019 16.10. Now it's also supported for Clang.

Highlighted C++23 features

  • P1048R1 Added is_scoped_enum, a new trait for the C++ Standard library, which detects whether a type is a scoped enumeration.
  • P1132R7 out_ptr(), inout_ptr()
  • P1679R3 contains() For basic_string and basic_string_view
  • P1682R3 to_underlying() for enumerations
  • P2162R2 Allow inheriting from std::variant
  • P2166R1 Prohibit constructingbasic_string and basic_string_view from nullptr. This change is a source-breaking change. Code that previously had undefined behavior at runtime is now rejected with compiler errors.
  • P2186R2 Removed garbage collection support. This change removes declare_reachable, undeclare_reachable, declare_no_pointers, undeclare_no_pointers, get_pointer_safety. Previously, these functions had no effect.

Highlighted performance improvements

  • <format> now detects when it's writing to a back_insert_iterator for a basic_string or a vector, and makes a faster call to insert() at the end() of the container.
  • We improved the performance of std::find() and std::count() for vector<bool> 19x and 26x (times, not percent).
  • We improved the performance of std::count() for vector<bool>
  • std::byte now has the same performance as unsigned char in reverse() and variant::swap()

Clang and LLVM support

  • LLVM tools shipped with Visual Studio have been upgraded to LLVM 12. For more information, see the LLVM release notes.

  • Clang-cl support was updated to LLVM 12.

  • You can now debug processes running on a remote system from Visual Studio by using LLDB.

C++ AMP deprecated

  • C++ AMP headers are now deprecated. Including <amp.h> in a C++ project generates build errors. To silence the errors, define _SILENCE_AMP_DEPRECATION_WARNINGS. For more information, see our AMP Deprecation links.

IntelliSense improvements

  • We made improvements in C++ IntelliSense when providing navigation and syntax highlighting for types from imported Modules and Header Units. IntelliSense is an active area of investment for us. Help us improve: Share your feedback on Developer Community by using Help > Send Feedback.

  • We improved C++ IntelliSense performance by optimizing cached header usage and symbol database access, providing improved load times to get into your code.

  • The IntelliSense Code Linter for C++ is now on by default, providing instant as-you-type suggestions and fix suggestions for common code defects.

  • C++ IntelliSense for CMake projects now works when using a preset with a display name.

C++ Workload updates

  • Updated to NDK r21 LTS in the C++ Mobile Development workload.

  • The Game development with C++ workload now installs the latest Unreal Engine with support with for Visual Studio 2022.

Code analysis improvements

  • Code analysis now enforces that return values of functions annotated with _Check_return_ or _Must_inspect_result_ must be checked.

  • We've improved null pointer dereference detection in our code analysis tooling.

  • Added support for gsl::not_null to code analysis.

  • Support for Libfuzzer under the /fsanitize=fuzzer compiler option.

Release notes for older versions

Release notes for older C++ versions are also available. For information on what's new for C++ in Visual Studio 2019, see What's new for C++ in Visual Studio 2019. For information on what's new for C++ in Visual Studio 2017, see What's new for C++ in Visual Studio 2017. For information on what's new in earlier versions, see Visual C++ What's New 2003 through 2015.

Known issues

C++ IntelliSense

For more information on other open issues and available workarounds for C++ in Visual Studio 2022, see the C++ Developer Community issues list.

Feedback and suggestions

We'd love to hear from you! You can Report a Problem or Suggest a Feature by using the Send Feedback icon in the upper right-hand corner of either the installer or the Visual Studio IDE, or from Help > Send Feedback. You can track your issues by using Visual Studio Developer Community, where you add comments or find solutions. You can also get free installation help through our Live Chat support.

Blogs

Take advantage of the insights and recommendations available in the Microsoft Developer Blogs site. They'll keep you up to date on all new releases. The blogs include deep dive posts on a broad range of features. You'll find the C++ Team Blog and the Visual Studio Blog of particular interest.