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.
What's new for C++ in Visual Studio version 17.4
For a summary of new features and bug fixes in Visual Studio in version 17.34, see Visual Studio 2022 version 17.3 Release Notes.
Improved compiler error messages to provide more correct and useful information, especially for concepts.
Added experimental MSVC flag
/experimental:log<directory>to output SARIF build logs 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
/Odif the user passes the
/std:c++20or later, or
- You can now disable NRVO with the
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 pre-included headers when one is a PCH. Previously, when a PCH was used via
/Yuand 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,
/FIheaders 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 have been removed, so users will 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
We continue to track the latest developments in C++ standardization. Support for these C++23 features is available by including
/std:c++latestin your compiler options:
string_viewRange Constructor Should Be
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.)
P2301R1 Add A
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
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
enumtype completion (for example, assignments to
enumvariables, case labels, returning
enumtype, 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.
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
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++20option. 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
We added various C++23 Library features, available under the
/std:c++latestoption. 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 17.1, 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.
Visual Studio's CMake integration is only active when a
CMakeLists.txtis identified at the root of the open workspace. If a
CMakeLists.txtis 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.
- 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
You can now configure and build your CMake projects with CMake 3.21 and
Visual Studio now supports the
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".
/scanDependenciescompiler 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:
u8string(and its iterators),
ranges::iota_view(and its iterator/sentinel),
stoi()family of functions in
<string>and to various functions in
<locale>such as the
has_facet(), and the
- P0980R1 Made
constexprin VS 2019 16.10. Now it's also supported for Clang.
- P1004R2 Made
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.
- P2162R2 Allow inheriting from
- P2166R1 Prohibit constructing
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
get_pointer_safety. Previously, these functions had no effect.
Highlighted performance improvements
<format>now detects when it's writing to a
vector, and makes a faster call to
end()of the container.
- We improved the performance of
vector<bool>19x and 26x (times, not percent).
- We improved the performance of
std::bytenow has the same performance as
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.
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
_Must_inspect_result_must be checked.
We've improved null pointer dereference detection in our code analysis tooling.
Added support for
gsl::not_nullto code analysis.
Support for Libfuzzer under the
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.
When importing a C++20 module or header unit, IntelliSense may stop working or 'There are too many errors' error is shown.
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.
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.