Redigera

Dela via


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

Visual Studio 2022 brings many updates and fixes to the Microsoft C++ compiler and tools. The Visual Studio IDE also offers significant improvements in performance and productivity, and now runs natively as a 64-bit application.

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

Released November 2024

For more information about See
What's new for C++ developers What's New for C++ Developers in Visual Studio 2022 17.12
Standard Library (STL) merged C++26 and C++23 features, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.12
New features in the Visual Studio 17.12 IDE Visual Studio 2022 version 17.12 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.12 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022 17.12

A quick highlight of some of the new features:

  • Standard Library Enhancements
    • C++23 Formatting ranges (P2286R8) implementation complete. Added formatters for the container adaptors stack, queue, and priority_queue.
    • Added multidimensional subscript operators, which also support <mdspan>. For example: print("m[{}, {}]: '{}'; ", i, j, m[i, j]).
  • Game development in C++
  • Build Insights
    • You can run Build Insights on selected files. Select the files you want in the Solution Explorer, right-click, and choose Run Build Insights on Selected Files: A screenshot of files in the Solution Explorer. The context menu is open and the option to Run Build Insights on Selected Files is highlighted.
    • You can filter Build Insights results by project. Click the filter button on the filter column header and select the projects you want to see results for: A screenshot of the Build Insights window with the Included Files tab open. The filter button was selected and a list of projects appears. Checkboxes next to Two projects are checked.
    • Clicking the question mark icon in the Build Insights window to see a short description for the tabs in the Build Insights window, and a link to the documentation for a detailed explanation: A screenshot of the Build Insights window with the view explanations button (a question mark in a circle) highlighted.
  • GitHub Copilot
    • You can click Ask Copilot next to the value of a variable to get AI-driven insights into what led to its current state. For example, the following program has an off-by-one error in its loop condition:

    A screenshot of the Autos window. The variable named it is NULL. The Ask Copilot icon next to it is highlighted.

    The code that caused this problem is: for (auto it = h.animals_.begin(); it <= h.animals_.end(); it++).

    If you click Ask Copilot icon for the it variable, it will tell you why it is <NULL>:

    A screenshot of a GitHub Copilot window.

    This error is inside a function defined as int calculate_number_of_cats(const house& h). The GitHub Copilot message says: "The value of the expression it is NULL, which means that the iterator is not pointing to any valid element in the vector animals_. In the context of your program, it is supposed to iterate over the animals_ vector in the house object to count the number of cat objects. Why it is null. Based on the locals and call stack context: the house object h has an empty animals_ vector (size=0). The loop condition it <= h.animals_.end() is incorrect. It should be it != h.animals_.end()."

    • You can click Ask Copilot about errors in the Visual Studio Error List to get help on the error and a suggested fix. For example:

    A screenshot of the Error List window.

    The Ask Copilot icon is highlighted next to an error that unique_ptr is attempting to reference a deleted function.

    If you click Ask Copilot, it tells you about the error:

    A screenshot of the GitHub Copilot explanation for the error.

    The Copilot message says: "The error occurs because the range-based for loop was attempting to copy std::unique_ptr objects, which is not allowed since std::unique_ptr cannot be copied. To fix this, I changed the loop to use a reference to avoid copying the std::unique_ptr objects. This way, the loop iterates over references to the std::unique_ptr objects, which is allowed."

  • Debugging
    • New debug visualizers for mutex, recursive_mutex, and move_iterator.
    • The debugger now displays return values inline: A screenshot of a tooltip showing the value 8.25. It is the result of the expression following the return statement that was  stepped over.

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

Released August 2024

For more information about See
What's new for C++ developers What's New for C++ Developers in Visual Studio 2022 17.11
Standard Library (STL) merged C++26 and C++23 features, C++20 defect reports, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.11
New features in the Visual Studio 17.11 IDE Visual Studio 2022 version 17.11 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.11 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022 17.11

A partial list of new features:

  • Standard Library Enhancements

    • The formatted output implementation now includes std::range_formatter and formatters for std::pair and std::tuple.
    • Added support for std::println() with no arguments. This prints a blank line as proposed in P3142R0.
    • Improved vectorization for several algorithms including replace_copy(), replace_copy_if(), ranges::replace_copy, ranges::replace_copy_if, find_first_of() and ranges::find_first_of, for 8-bit and 16-bit elements, mismatch(), ranges::mismatch, count() ranges::count, find(), ranges::find, ranges::find_last, and ranges::iota.
  • Game development in C++

    • You can now add common Unreal Engine class templates, modules, and plugins from within Visual Studio. For more information, see Add Unreal Engine classes, modules, and plugins in Visual Studio.
    • The new Unreal Engine toolbar provides quick access to Unreal Engine related actions from within Visual Studio. The toolbar allows you to quickly attach to Unreal Engine processes, rescan the Blueprints cache, quickly access the Unreal Engine Log, and provides quick access to the Unreal Engine Configuration Page for Visual Studio. For more information, see Unreal Engine Toolbar.
    • You can now filter trace results by project. Also, results in each row show the relative path and file name instead of the full path. Results grouping in the Included Files view is also improved:

    A screenshot of the improved Included Files diagnostics results.

    The Included Files view has a new column for the project. The Project column is selected and projects such as (Select All), CompilerIdC, OpenAL, common, and so on, are selected. The included files are listed by relative path and file name and grouped together.

  • CMake debugging

    • You can now debug your CMake scripts and CMakeLists.txt files in the Visual Studio debugger for CMake projects that target Linux via Windows Subsystem for Linux (WSL) or SSH. To start a CMake debugging session in Visual Studio, set a breakpoint in your CMakeLists.txt file and then navigate to Project > Configure Cache with CMake Debugging.
  • GitHub Copilot

    • When you hover over symbols in the code editor, click the Copilot Tell me more button in the Quick Info dialog to learn more about a given symbol:

    A screenshot of the Quick Info window.

    The Quick Info window is shown above a function. The Tell me more link is highlighted.

    • GitHub Copilot can generate naming suggestions for your identifiers (variables, methods, or classes) based on how your identifier is used and the style of your code.

      A screenshot of the GitHub Copilot Rename dialog.

      The Rename dialog has a New name field with a dropdown list that shows these choices: text_color, font_color, display_color, console_color, and menu_text_color.

    You need an active GitHub Copilot subscription. Right-click the variable you wish to rename, and choose Rename (Ctrl+R, Ctrl+R). Select the GitHub Copilot sparkle icon to generate naming suggestions.

  • Debugging

    • Conditional breakpoints in C++ are faster.
  • Diagnostics improvements

    • Improved diagnostics when calling std::get<T> on a std::tuple that has multiple instances of T in its template arguments. MSVC used to report:
      error C2338: static_assert failed: 'duplicate type T in get<T>(tuple)'.
      Now it reports:
      error C2338: static_assert failed: 'get<T>(tuple<Types...>&) requires T to occur exactly once in Types.(N4971 [tuple.elemm]/5)'
    • Improved diagnostics when std::ranges::to is unable to construct the requested result. MSVC used to report:
      error C2338: static_assert failed: 'the program is ill-formed per N4950 [range.utility.conv.to]/2.3'
      Now it reports:
      error C2338: static_assert failed: 'ranges::to requires the result to be constructible from the source range, either by using a suitable constructor, or by inserting each element of the range into the default-constructed object. (N4981 [range.utility.conv.to]/2.1.5)'

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

Released May 2024

For more information about See
What's new for C++ developers What's new for C++ Developers in Visual Studio 2022 17.10
Standard Library (STL) merged C++26 and C++23 features, C++20 defect reports, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.10
New features in the Visual Studio 17.10 IDE Visual Studio 2022 version 17.10 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.10 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022 17.10

A partial list of new features:

  • MSVC Toolset Update: The MSVC toolset version is updated from 19.39 to 19.40. This may affect projects that have version assumptions. For more information about some ways in which this affects projects that assume that MSVC versions are all 19.3X for Visual Studio 2022 releases, see MSVC Toolset Minor Version Number 14.40 in VS 2022 v17.10.
  • Standard Library Enhancements: The standard library added support for P2510R3 Formatting Pointers, which brings the set of format specifiers for pointers when using std::format more in line with those that already exist for integers. Improved the vectorized implementations of std::min_element, std::ranges::min, and friends.
  • Build Insights: Now provides template instantiation information. See Templates View for Build Insights in Visual Studio or the Pure Virtual C++ - Templates view for Build Insights in Visual Studio recording.
  • Unreal Engine Plugin: There's a new opt-in feature for the Unreal Engine Plugin to run in the background, reducing startup costs. This is an opt-in feature that is activated via Tools > Options > Unreal Engine.
  • New features for Linux: See New Linux Development Features in Visual Studio.
  • CMake Targets: You can now pin targets in the CMake Targets View.
  • Connection Manager UX: The user experience provides a more seamless experience when connecting to remote systems. For more information, see Usability Improvements in the Visual Studio Connection Manager.
  • Pull request comments: You can now view GitHub and Azure DevOps comments directly in your working file. Enable the feature flag, Pull Request Comments in Options > Environment > Preview Features and checkout the pull request branch to get started.
  • AI-Generated Content: GitHub Copilot can now draft pull request descriptions. Requires an active GitHub Copilot subscription. Try it out by clicking the Add AI Generated Pull Request Description sparkle pen icon within the Create a Pull Request window.
  • Image Preview: Hover over an image path to see a preview with size details. The size is capped to 500 px wide and high.

    Screenshot of hover preview.

    The mouse is hovering over the line std::filesystem::path vs_logo_path = "../images/vs_logo.png". Underneath appears a preview of the Visual Studio logo and the information that it's 251 x 500 pixels and 13.65 KB in size.

  • Breakpoint/Tracepoint Creation: You can now create conditional breakpoints or tracepoints directly from expressions in the source code from the right-click menu. This works on property or field names and values from autos, locals, watch windows, or DataTips.
  • Attach to Process Dialog: The functionality provided by the Attach to Process dialog is more user-friendly. You can now easily switch between tree and list views, organize processes better with collapsible sections, and select code types with a simplified combobox. Also, the "Select/Track Window" feature is now easier to use, allowing two-way tracking: selecting a process highlights its window, and clicking on a window selects its process.
  • GitHub Copilot Integration: GitHub Copilot and Copilot Chat extensions are now unified and now ship directly in Visual Studio. To install it, install the GitHub Copilot component in the Visual Studio Installer:

    Screenshot of the Visual Studio Installer GitHub Copilot installation option.

    The GitHub Copilot interface is in the top-right corner of Visual Studio. To use it, you need an active GitHub Copilot subscription.

    Screenshot of GitHub Copilot button.

    The GitHub Copilot button is shown in the top-right corner of Visual Studio. It has options to open a chat window, GitHub Copilot settings, learn more, and manage copilot subscription.

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

Released Feb 2024

For more information about See
What's new for C++ developers What's new for C++ Developers in Visual Studio 2022 17.9
Standard Library (STL) merged C++23 features, performance improvements, enhanced behavior, LWG issue resolutions, and fixed bugs STL Changelog 17.9
New features in the Visual Studio 17.9 IDE Visual Studio 2022 version 17.9 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.9 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022
Summary of C++ backend updates MSVC Backend updates since Visual Studio 2022 version 17.3

A partial list of new features:

  • #include diagnostics, which provides a detailed analysis of your #include directives. Activate this feature by right-clicking an #include and choosing #include directives > Turn #include directive diagnostics on. Above each #include is the number of times your code references that #include file. Click the reference link to navigate to where your code uses something from that header file. To view the build time of your #include directives, run Build Insights by navigating to Build > Run Build Insights on Solution > Build.

    Screenshot of #include diagnostics.

    Above the # include is a **reference** link and many of the references to this # include file (in this case 1). The build time is also listed (in this case less than 1/2 a second).

  • Memory layout visualization, which shows how memory is arranged for your classes, structs, and unions. Hover over a type and choose the Memory Layout link in the Quick Info to open a dedicated window displaying the memory layout of the selected type. Hovering over individual data types within this window provides detailed information about their size and offset within the type.

    Screenshot of the memory layout window

    The memory layout window shows the contents of the Snake class. It shows the memory offsets of the various fields of the class such as Point classes for the location of the head and body, the score, and so on.

  • You can now specify your own custom CMake executable. This feature is useful if you want to use a specific version of CMake that isn't shipped with Visual Studio. Navigate to Tools > Options and select CMake > General. Select Enable custom CMake executable and specify the directory path of your CMake executable.

    Screenshot of the CMake options dialog

    The CMake options dialog with the "Enable custom CMake executable" option and "CMake Executable Directory" field highlighted.

  • Improved IntelliSense for Unreal Engine projects.
  • Improved C++23 support: std::format and std::span formattable, range_format, format_kind, and set_debug_format() as part of P2286R8 Formatting Ranges <mdspan> per P0009R18 and subsequent wording changes that were applied to the C++23 Standard. Also, format() can format pointers per P2510R3.

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

Released Nov 2023

For more information about See
What's new for C++ developers What's new for C++ Developers in Visual Studio 2022 17.8
Standard Library (STL) merged C++26, C++23 features, C++20 extensions, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.8
New features in the Visual Studio 17.8 IDE Visual Studio 2022 version 17.8 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.8 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022
An overview of C++ improvements in Visual Studio, VS Code, and vcpkg during 2023 A year of C++ improvements

A partial list of new features:

  • C++ structured diagnostics in the Output window and a new problem details window that provides more information about the error. For more information, see Structured SARIF Output and Problem Details Window.
  • A feature that lets you visualize the size and alignment of your classes, structs, unions, base types, or enums even before the code is compiled. Hover over the identifier and a Quick Info displays the size and alignment information.
  • A feature that suggests when to mark member functions const because they don’t modify the object’s state. Hover over a member function and click the light bulb icon to mark the function as const.
  • Visual Studio now prompts you to mark global functions as static via a screwdriver icon that appears by the function name. Click the screwdriver icon to mark the function as static.
  • Unused #include directives are dimmed in the editor. You can hover over a dimmed include and use the light bulb menu to either remove that include or all unused includes. You can also add #include directives for entities that are indirectly included via other headers. For more information, see Clean up C/C++ includes in Visual Studio.
  • More Unreal Engine support:
    • Unreal Engine Test Adapter lets you discover, run, manage, and debug your Unreal Engine tests without leaving the Visual Studio IDE.
    • With Unreal Engine Code Snippets, you can find common Unreal Engine constructs as snippets in your member list.
    • Build Insights is now integrated with Visual Studio 2022 and works with MSBuild and CMake projects using MSVC. You can now see additional information about the compilation of a function such as how long it took to compile and the number of ForceInlines, and the impact of header files on build time. For more information, see Tutorial: Troubleshoot function inlining on build time and Tutorial: Troubleshoot header file impact on build time.
  • Remote Linux unit test support now lets you run your CTest and GTest tests on your remote Linux machines from Visual Studio’s Test Explorer, just like your local tests.

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

Released Aug 2023

For more information about See
What's new for C++ developers What’s new for C++ Developers in Visual Studio 2022 17.7
New C++ features specific to game development Unleashing the Power of Visual Studio 2022 for C++ Game Development
Standard Library (STL) merged C++23 features, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.7
New features in the Visual Studio 17.7 IDE Visual Studio 2022 version 17.7 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.7 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022

A partial list of new features:

  • Faster debugging sessions and faster project load times
  • Step-by-step visualization of macro expansion
  • One-click download for Windows Subsystem for Linux (WSL)
  • Improved support for Doxygen comments
  • C++ Build Insights for game development
  • Added /std:clatest for the C compiler.
  • Unreal Engine project improvements such as faster IntelliSense and syntax colorization, the ability to find all Unreal Engine Blueprint references, and more.

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

Released May 2023

For more information about See
What's new for C++ developers What’s New for C++ Developers in Visual Studio 2022 17.6
Standard Library (STL) merged C++23 features, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.6
New features in the Visual Studio 17.6 IDE Visual Studio 2022 version 17.6 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.6 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022

A partial list of new features includes:

  • CMake script debugging
  • Built-in support for High Level Shading Language (HLSL)
  • Unreal Engine Log viewer
  • VCPKG is now added by default
  • Initial support for C++20 in C++/CLI projects and some C++23 standard library features for ranges.

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

Released Feb 2023

For more information about See
What's new for C++ developers What’s New for C++ Developers in Visual Studio 2022 17.5
Standard Library (STL) merged C++23 features, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.5
New features in the Visual Studio 17.5 IDE Visual Studio 2022 version 17.5 Release Notes

A partial list of new features includes:

  • std::move, std::forward, std::move_if_noexcept, and std::forward_like now don't produce function calls in generated code, even in debug mode. This change avoids named casts causing unnecessary overhead in debug builds. /permissive- (or an option that implies it, such as /std:c++20 or std:c++latest) is required.

  • Added [[msvc::intrinsic]]. You can apply this attribute to nonrecursive functions consisting of a single cast, which take only one parameter.

  • Added support for Linux Console in the Integrated Terminal, which allows for terminal I/O.

  • Added initial experimental support for C11 atomic primitives (<stdatomic.h>). You can enable this experimental feature with the /experimental:c11atomics option in /std:c11 mode or later.

  • Added a new set of experimental high-confidence checks to the Lifetime Checker for reduced noise.

  • A new preview feature, Remote File Explorer, lets you view the file directory on your remote machines within VS, and upload and download files to it.

  • Changed versioning of CMake executables shipped with Visual Studio to match Kitware versions.

  • Added support for Hot Reload to the CMake Project template.

  • Go To Definition for C++ now uses a more subtle indicator of the operation taking more time, replacing the modal dialog from previous versions.

  • Started rollout of an experiment providing more smart results in the C++ autocompletion and member list. This functionality was previously known as Predictive IntelliSense but now uses a new presentation method.

  • We now ship a native Arm64 Clang toolset with our LLVM workload, allowing native compilation on Arm64 machines.

  • Added localization to the Image Watch Extension (This extension is available in the Marketplace, and isn't bundled through the Visual Studio Installer).

  • Added support for opening a Terminal window into the currently running Developer Container.

  • Made several improvements to IntelliSense macro expansion. Notably, we enabled recursive expansion in more contexts, and we added options to the pop up to copy the expansion to the clipboard or expand the macro inline.

  • Concurrent monitoring is now supported in the Serial Monitor. Concurrent monitoring allows you to monitor multiple ports at the same time side by side. Press the plus button to open another Serial Monitor and get started.

  • You can now view properties from base classes modified in an Unreal Blueprint asset without leaving Visual Studio. Double-click in a Blueprint reference for a C++ class or property to open the UE Asset Inspector in Visual Studio.

  • Enabled running DevContainers on a remote Linux machine.

  • Enabled selection of multiple targets to build in the CMake Targets view.

  • Added support for CMakePresets.json version 5. See the CMake documentation for information of new features.

  • Enabled Test Explorer to build and test multiple CMake targets in parallel.

  • Added "Open container in terminal" option to Dev Containers.

  • Implemented standard library features:

    • P2508R1 basic_format_string, format_string, wformat_string
    • P2322R6 ranges::fold_left, ranges::fold_right, and so on.
    • P2321R2 views::zip (doesn't include zip_transform, adjacent, and adjacent_transform)

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

Released Nov 2022

For more information about See
What's new for C++ developers What’s New for C++ Developers in Visual Studio 2022 17.4
Standard Library (STL) merged C++23 features, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.4
New features in the Visual Studio 17.4 IDE Visual Studio 2022 version 17.4 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.4 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022

A partial list of new features in 17.4:

  • Improved compiler error messages to provide more correct and useful information, especially for concepts.

  • Added experimental MSVC option /experimental:log<directory> to output structured SARIF diagnostics to the specified directory.

  • Added support for C23 attributes to IntelliSense and continued progress in C++20 modules support.

  • Improved indexing performance when opening a new solution. Large projects could see a 20-35% improvement from 17.3.

  • Improved Named Return Value Optimization (NRVO):

    • NRVO is enabled for cases that involve exception handling or loops.
    • NRVO is enabled even under /Od if the user passes the /Zc:nrvo option, or /std:c++20 or later, or /permissive-.
    • You can now disable NRVO with the /Zc:nrvo- option.
  • Upgraded the version of LLVM shipped with Visual Studio to 15.0.1. For more information on what is available, see the LLVM and Clang release notes.

  • Added support to Visual Studio for vcpkg artifacts with CMake projects. For projects that include a vcpkg manifest, the environment is activated automatically on project open. Learn more about this feature in the vcpkg environment activation in Visual Studio blog post.

  • You can now use Dev Containers for your C++ projects. Learn more about this feature in our Dev Containers for C++ blog post.

  • IntelliSense now respects the order of preincluded headers when one of them is a PCH. Previously, when a PCH was used via /Yu and force-included via /FI, IntelliSense would always process it first, before any other headers included via /FI. This behavior didn't match the build behavior. With this change, /FI headers are processed in the order they're specified.

  • Removed internal prefixes from CTest names in Test Explorer.

  • Updated the version of CMake shipped with Visual Studio to version 3.24.1. For details of what is available, see the CMake release notes.

  • Android SDK update:

    • Ant scripts were removed, so users no longer see Ant-based templates in the New Project dialog. For help migrating from Ant templates to Gradle templates, see Migrating Builds From Apache Ant
    • Added support for building with NDK 23 and 24
    • Updated NDK component to the LTS version 23
  • Added vectorized implementations of ranges::min_element(), ranges::max_element(), and ranges::minmax_element()

  • We continue to track the latest developments in C++ standardization. Support for these C++23 features is available by including /std:c++latest in your compiler options:

    • P2302R4 ranges::contains, ranges::contains_subrange

    • P2499R0 string_view Range Constructor Should Be explicit

    • P0849R8 auto(x): decay-copy In The Language

      (The compiler part isn't implemented yet. The library part was implemented in C++20 mode when Ranges support was initially implemented.)

    • P0881R7 <stacktrace>

    • P2301R1 Add A pmr Alias For std::stacktrace

    • P1328R1 constexpr type_info::operator==()

    • P2440R1 ranges::iota, ranges::shift_left, ranges::shift_right

    • P2441R2 views::join_with

  • Added an option "Navigation after Create Declaration/Definition" to allow you to choose the navigation behavior of the Create Declaration/Definition feature. You can select between peeking (the default) or opening the document, or no navigation.

  • Arm64 builds of Visual Studio now bundle Arm64 versions of CMake and Ninja.

  • Added support for CMake Presets version 4. For details of what is available, see the CMake release notes.

  • Remote system connections using the Connection Manager now support SSH ProxyJump. ProxyJump is used to access an SSH host via another SSH host (for example, to access a host behind a firewall).

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

Released Aug 2022

For more information about See
What's new for C++ developers C++ improvements in 17.3
Standard Library (STL) merged C++23 features, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.3
New features in the Visual Studio 17.3 IDE Visual Studio 2022 version 17.3 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.3 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022

A partial list of new features in 17.3:

  • 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). The responsiveness of Go To All is improved. 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 for non-MSBuild scenarios and to 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.
  • 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

Released May 2022

For more information about See
What's new for C++ developers Visual Studio 2022 17.2 is now available
Standard Library (STL) merged C++20 defect reports, C++23 features, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.2
New features in the Visual Studio 17.2 IDE Visual Studio 2022 version 17.2 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.2 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022

A partial list of new features in 17.2:

  • 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 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 opens in the memory window.
    • 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.
  • 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

Released Feb 2022

For more information about See
What's new for C++ developers Visual Studio 2022 17.1 is now available!
Standard Library (STL) merged C++23 features, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.1
New features in the Visual Studio 17.1 IDE Visual Studio 2022 version 17.1 Release Notes
C++ language conformance improvements in Visual Studio 2022 17.1 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022

A partial list of new features in 17.1:

  • A new Configure Preset template is 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 are 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're prompted to activate Visual Studio's CMake integration with a notification.
  • New views that enable you to inspect and interact with peripheral registers on microcontrollers and real time operating systems (RTOS) objects, available through Debug > Windows > Embedded Registers
  • Added a new thread view for RTOS projects, available through Debug > Windows > RTOS Objects. For more information, see Embedded Software Development in Visual Studio.

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

Released Nov 2021

For more information about See
New features in the Visual Studio 17.0 IDE Visual Studio 2022 version 17.0 Release Notes
Standard Library (STL) merged C++23 and C++26 features, C++20 defect reports, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs STL Changelog 17.0
C++ language conformance improvements in Visual Studio 2022 17.0 C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022 17.10

An overview of some of the new features in Visual Studio 2022 version 17.0:

  • 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

  • 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 are 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 is 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 P1689R5. 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 supported for Clang.
  • P1004R2 Made std::vector constexprin VS 2019 16.10. Now 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 constructing basic_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 are 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 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.
  • Null pointer dereference detection is improved 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:

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 to stay up to date on all new releases. The blogs include deep dive posts on a broad range of features. The C++ Team Blog and the Visual Studio Blog are of particular interest.