A Year of C++ Improvements in Visual Studio, VS Code, and vcpkg

Sy Brand

As we enter the new year, it’s a good time to look back at all the features and improvements we made for C++ developers in our tools in 2023. We’ve made advancements across Visual Studio, Visual Studio Code, our toolchain, and the vcpkg package manager in both performance and functionality. Some particular areas of focus have been ARM64 support, Unreal Engine development, code safety, and cross-platform development.

Contents

Cross-Platform
Productivity
Game Development
Build Insights Build Insights
Visual Studio IDE Performance IDE Performance
Toolchain
vcpkg vcpkg
Visual Studio Code C++ Extension
Visual Studio Code CMake Extension
Conference Talks Conference Talks

Visual Studio

Cross-Platform

Cross-platform development is a first-class citizen in Visual Studio and has been for many years now. We’ve added many new features for those targeting Linux, Windows Subsystem for Linux, embedded platforms, and those using CMake for their builds.

Integrated Linux Terminal

  • The Linux Integrated Terminal allows you to debug Linux applications with a fully-featured terminal experience directly inside Visual Studio.

Linux console output appearing in Visual Studio terminal window

Test and Build Multiple CMake Targets

You can now test and build multiple CMake Targets from the CMake Targets view.

A screenshot of a computer Description automatically generated with medium confidence

CMake Debugger

Use the CMake Debugger to debug your CMake scripts like you would any other program. You can set breakpoints, see the values of CMake variables at the current point of execution, and more.

Screenshot of Visual Studio in a debugging session showing an exception dialog that originated from a CMake script

Remote File Explorer

Use the Remote File Explorer to see a directory tree of the files on a remote system.

The Remote File Explorer lets you view your files on your remote machines

STM32CubeIDE Project Support

Import STM32CubeIDE projects with the new STM32CubeIDE Project Support.

File menu entry for Import STM32CubeIDE project option

Automatic Windows Subsystem for Linux Installation

Install Windows Subsystem for Linux automatically from Visual Studio with “Install WSL for Me”.

Image WSL Automatic Acquisition

Remote Linux Unit Test Support

Remote Linux unit test support adds your remote Linux tests to the Test Explorer.

View test results from remote environment in the test explorer

Productivity

We want your development to be as fast and low-friction as possible. Our productivity features address this, giving you better ways to complete your day-to-day tasks.

Sticky Scroll

Sticky Scroll gives you context for the current code location in your editor by sticking the top line of nested blocks to the top of the window.

An animation of the Sticky Scroll feature being used in C++ code.

Brace Pair Colorization

Brace Pair Colorization lets you easily see matching brace pairs by making them the same color.

C++ Brace Pair Colorization example

Spell Checker

The new Spell Checker finds and corrects spelling issues in your code.

A screen shot of a computer Description automatically generated

All-in-one Search

All-in-one Search joints together the code search and feature search functions into one tool.

A screenshot of a computer Description automatically generated

Breakpoint Groups

Breakpoint groups let you organize breakpoints to make large collections easier to manage.

A screenshot of a computer Description automatically generated

File Comparison Window

You can now compare files straight from the solution explorer with the File Comparison window.

A screenshot of a computer program Description automatically generated

Copy-paste with Correct Indentation

Copy-paste with correct indentation makes it easier to accurately share code with others.

A screenshot of a computer screen Description automatically generated

Parallel Stack Filtering

Parallel stack filtering lets you selectively display or hide specific threads or frames.

A screenshot of a computer Description automatically generated

Doxygen for Overloaded Functions

We improved Doxygen behaviour for overload resolution.

Image Improved Doxygen overload resolution

Macro Expansion Visualization

You can now see macro expansions step-by-step with Macro Expansion Visualization.

A screenshot of a computer program Description automatically generated

Create GitHub Pull Request from Visual Studio

You can now create GitHub pull requests from Visual Studio.

A screenshot of a computer Description automatically generated

Structured Diagnostics

Visualize complex, hierarchical compiler errors with structured diagnostics.

A screenshot of a computer Description automatically generated

Size and Alignment of Types

See size and alignment of types directly in the editor.

A screenshot of a computer Description automatically generated

Memory Layout Visualization

Use our new memory layout visualization tool for seeing how types will be stored in memory.

A GIF displaying an example of Memory Layout

Include Cleanup

Optimize your #includes with #include directive cleanup.

A screen shot of a computer screen Description automatically generated

Game Development

Game development is a key area of focus for us, as game developers often have constraints and workflows which other C++ developers do not. Last year we focused especially on our Unreal Engine support.

Unreal Engine Blueprint References and Asset Inspector

Navigate your Unreal Engine Blueprints with the new Unreal Engine Blueprint References and Asset Inspector.

A screenshot of UE Blueprint references in Visual Studio.

Unreal Engine Log Viewer

Use the Unreal Engine Log Viewer to see your UE logs directly in Visual Studio.

Unreal Engine Log tool window in Visual Studio showing several lines of logs outputted by an Unreal Engine game

HLSL Support

Edit HLSL shaders with improved HLSL editor integration.

HLSL editor showcasing syntax highlighting

Unreal Engine Macro Formatting

Unreal Engine macro formatting ensures that your UE macros are handled appropriately by the autoformatter.

Image Unreal Engine Macros Formatting for C

Unreal Engine Naming Convention Checker

Use the Unreal Engine naming convention checker to ensure your code conforms to expectations.

Image Unreal Engine Naming Convention Checker for C

Unreal Engine Blueprint Find All References

Find all UE Blueprint references with a single command using Unreal Engine Blueprint Find All References.

A screenshot of a computer Description automatically generated

Unreal Engine Test Adapter

The Unreal Engine test adapter adds your UE tests to the Test Explorer window.

A screenshot of a computer Description automatically generated

Unreal Engine Code Snippets

Use Unreal Engine code snippets to quickly generate common UE-specific code.

A computer screen shot of a program code Description automatically generated

Unreal Engine Macro Specifier Suggestions

Unreal Engine macro specifier suggestions gives you a quick description of UE macros without you having to leave your editor.

A screenshot of a computer program Description automatically generated

Build Insights

C++ Build Insights is a collection of tools that collect data about your C++ builds and present it in a format that can help you answer common questions, like:

  • Are my builds sufficiently parallelized?
  • What should I include in my pre-compiled header (PCH)?
  • Is there a specific bottleneck I should focus on to increase my build speeds?

Last year, we integrated Build Insights into Visual Studio, letting you see details on how your #includes are affecting your builds:

The Included Files view of the Build Insights analysis window

We then added a Functions View for seeing the amount of time the compiler took to process specific functions:

A screenshot of a computer Description automatically generated

IDE Performance

As well as the performance of your code, we continue to work on the performance of Visual Studio itself. Here are some of the highlights.

  • Improved time-to-open and time-to-close

Chart showing performance comparison between VS 17.5 and 17.6 on Solution Load and Solution Close. Both charts show significant improvements in the latest release.

  • Improved time-to-colorization

a graph showing time to intellisense bench marked on unreal engine 5.1. VS 17.8 =1.3s VS 17.7 =1.8s

  • Improved debug launch performance

graph showing faster debugger launch speed 24 secs in 17.7 and 19 secs in 17.8

Toolchain

Our toolchain for C++ spans components such as the MSVC compiler, our open-source C++ standard library implementation, and our code analysis tools.

Conformance

For conformance with the C and C++ standards, we added support for C11 atomics and threads. We also extended our C++20 support to C++/CLI projects. We also shipped the standard library modules which are available in both C++23 mode and C++20 mode (the latter is a cross-vendor extension).

You can see the STL changelog for full details of our advances on our open-source standard library. You can also see the live STL Status Chart to see where we’re at for standards conformance. At the time of writing, only 8 standard library features remain for C++23 conformance. Thank you to everyone who contributed features in the last year! Please continue to file issues and create pull requests on the GitHub repository; this is very much a community project.

We also open-sourced the IFC SDK for C++ Modules, which provides an interface for interacting with IFC files. IFC is an on-disk binary format which stores a representation of C++ source code for machine consumption. It was designed to implement C++ Modules, but can be used for other tools which require information about C++ code and don’t want to integrate a full C++ parser. The Microsoft Office Word codebase began adopting header units with MSVC, which you can read about in Integrating C++ header units into Office using MSVC.

Finally, we wrote extensive documentation for C++20 Ranges.

Image view2

Code Performance

We’ve been working on the MSVC backend to improve code generation so that your C and C++ code runs as fast as possible. We’ve introduced new optimizations for ARM64 (particularly the auto-vectorizer for NEON instructions) as well as ones which will benefit all architectures (e.g. optimizations across basic blocks and vectorized loops). We also improved debug build performance by introducing new inlining controls for named type casts (like std::move and std::forward). Here are some blog posts which describe some of the bigger changes we’ve made in the past year:

Code Safety

Code safety has been one of our team’s key focuses for the past several years. In addition to improvements to our Address Sanitizer support and static analysis tools, we produced a set of guidelines on how to build reliable and secure C++ programs. This is a section-by-section companion to the United States government publication NISTIR 8397: Guidelines on Minimum Standards for Developer Verification of Software.

Here are blog posts on some of the key improvements we made:

vcpkg

vcpkg is our free, cross-platform package manager for C and C++. Here are some of the main advancements we made in the last year:

Visual Studio Code

We have official Visual Studio Code extensions for C++, CMake, Makefiles, and Embedded. We also maintain a C/C++ Extension Pack, which collects some of these and other helpful extensions. We introduced many new features last year, most of them in response to issues filed on GitHub, so please keep sending in your feedback!

C++ Extension

Missing Header File Quick Fix

We introduced new Quick Fixes for missing header files – if there is an unknown symbol in your C++ code and the C/C++ Extension identifies the correct header file in your workspace, you will now have a quick fix available.

a user selecting a variable with an underline, selecting the fixit and then selecting insert header. This adds the header to the top of their file.

Call Hierarchy View

Use the new Call Hierarchy view to can easily navigate your codebase – especially to understand the complex calling relationships between functions. This was our most requested feature in 2023 and 3rd most requested feature of all time!

The gif shows a user navigating to their call hierarchy by right clicking a function with a Quick Fix available, then selecting "Show Call Hierarchy". This opens a side bar with all the calls. The user then clicks on the phone icon in the menu of the side bar to toggle between calls from and calls to for that function.

Extract Code to Function

You can also now automatically extract code into a function – our 2nd most requested feature of 2023,and 10th most requested feature of all time!

Image ExtractMethodwithoutexperimentation

New Compiler Acquisition Process

We added a new, simpler C++ compiler acquisition process.

Image install a compiler mac, shows that for the configure intellisense command you can select install compiler

Create Declaration/Definition

You can now automatically generate a function definition from a function declaration and vice versa with the Create Declaration/Definition feature.

A screen shot of a computer Description automatically generated

Copy Function Declaration/Definition

You can also copy function declarations/definitions to the clipboard to customize where the declaration/definition is placed in your code. to the clipboard.

Gif showing that when you are creating a declaration/definition, when you click on the function, rather than selecting "create declaration" you will select "copy declaration" and vice versa for declarations.

Markdown Comment Formatting

When commenting on your code, you can now use markdown to format your comments when using the hover tooltip.

Looking Forward

Looking forward, we are focusing on performance, so keep an eye out in 2024 for new features for a faster, more efficient experience in the C/C++ Extension!

CMake Extension

Test Explorer

We added a Test Explorer for CTest which lets you view details of your tests and their latest results.

The new Test Explorer in action

vcpkg Portfile Debugging

We added support for vcpkg portfile debugging.

Debugging your portfile.cmake using the CMake debugger

Simplified CMake Status Bar

We simplified the CMake Status Bar.

The new CMake status bar only has Build, Debug, and Run options by default

CMake Debugger

As with Visual Studio, use the new CMake Debugger to debug your CMake scripts like you would any other program. You can set breakpoints, see the values of CMake variables at the current point of execution, and more.

A black box with blue text Description automatically generated

Conference Talks

Our main two events for this year were CppCon and Pure Virtual C++. You can read our trip report for CppCon to find out what we thought.

Here are the videos for all our talks this past year at many conferences:

Send us your feedback!

The comments below are open for us to track any requests. You can also find us on Twitter (@VisualC) or via email at visualcpp@microsoft.com. To open a bug for Visual Studio, please see Visual Studio Feedback. To leave feedback for VS Code, visit the GitHub repository for the C++, CMake, Makefiles, or Embedded extension. We look forward to another year of C++!

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • krodor 0

    VCpkg in visual studio requires manifest mode per project. I originally had vcpkg installed and working in the older shared directory mode. While it was possible to re-establish the vcpkg install after pulling the pre-VS version out, installing the VS version, and setting up manifest files, and it would auto-install vcpkg dependencies, link/build the project correctly, intellisense always reported the vcpkg dependency include files as invalid, and would not support type data from them. This seemed to finally auto-fix itself re-opening projects with the new 17.9 release.

    • Peter Nimmo 0

      I’m also not too keen on VCPKG, as you say the shared directory mode is what I want as far as all libraries are put in the same place. However I also like the ability to specify components using the manifest, but then every project recreates the libraries again and again. Yes the binary caching can be setup, but I don’t want loads of copies of Boost, or Google Fruit, or Catch2 etc everywhere.

Feedback usabilla icon