title | description | ms.date | ms.technology | ms.custom |
---|---|---|---|---|
What's new for C++ in Visual Studio |
The new features and fixes in the Microsoft C/C++ compiler and tools in Visual Studio. |
11/05/2021 |
cpp-ide |
intro-whats-new |
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.
For a summary of new features and bug fixes in Visual Studio, see What's New 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 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 Edot 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.
-
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 inCMakePresets.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 P1689r3. It's a step towards support for building modules-based projects with CMake and we're working on completing this support in later releases.
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
, andfilesystem::path
- Added
[[nodiscard]]
to thestoi()
family of functions in<string>
and to various functions in<locale>
such as thecollate
member functions,has_facet()
, and theisalnum()
andtolower()
families. - P0980R1 Made
std::string
constexpr
in VS 2019 16.10. Now it's also supported for Clang. - P1004R2 Made
std::vector
constexpr
in 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()
Forbasic_string
andbasic_string_view
- P1682R3
to_underlying()
for enumerations - P2162R2 Allow inheriting from
std::variant
- P2166R1 Prohibit constructing
basic_string
andbasic_string_view
fromnullptr
. This is a source-breaking change. Code that previously had undefined behavior at runtime will now be rejected with compiler errors. - P2186R2 Removed garbage collection support. This 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 aback_insert_iterator
for abasic_string
or avector
, and makes a faster call toinsert()
at theend()
of the container.- Improved the performance of
std::find()
andstd::count()
forvector<bool>
19x and 26x (times, not percent). - Improved the performance of
std::count()
forvector<bool>
std::byte
now has the same performance asunsigned char
inreverse()
andvariant::swap()
-
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 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.
-
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.
-
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 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 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.
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.
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.