C++ Team Blog
The latest in C++, Visual Studio, VS Code, and vcpkg from the MSFT C++ team
Latest posts
MSVC Backend Updates in Visual Studio 2019 Versions 16.3 and 16.4
Versions 16.3 and 16.4 of Visual Studio 2019 brought many new improvements in code generation quality, build throughput, and security. If you still haven’t downloaded your copy, here is a brief overview of what you’ve been missing out on. Demonstration of C++ Build Insights, a new set of build analysis tools in Visual Studio 2019 version 16.4. Visual Studio 2019 version 16.3 Visual Studio 2019 version 16.4 Do you want to benefit from all of these improvements? If so, download the latest Visual Studio ...
CMake, Linux targeting, and IntelliSense improvements in Visual Studio 2019 version 16.5 Preview 2
Visual Studio’s native support for CMake allows you to target both Windows and Linux from the comfort of a single IDE. Visual Studio 2019 version 16.5 Preview 2 introduces several new features specific to cross-platform development, including: File copy optimizations for CMake projects targeting a remote Linux system Visual Studio automatically copies source files from your local Windows machine to your remote Linux system when building and debugging on Linux. In Visual Studio 2019 version 16.5 this behavior has been optimized. Visual Studio now keeps a "fingerprint file" of the ...
C++ Modules conformance improvements with MSVC in Visual Studio 2019 16.5
C++20 is right around the corner. Along with the new standard comes the much anticipated Modules feature! The compiler team initially announced that we were working on the Modules TS back in 2017 and since then we have been hard at work improving the feature and improving compiler conformance around this feature. We finally feel it is time to share some of the progress we have made on the conformance front for Modules. What's new? Header Unit Support In C++20 [module.import]/5 describes the import of a new translation unit type, the header unit. The semantics of this type of import are ...
Improvements to Accuracy and Performance of Linux IntelliSense
This blog post was written by Paul Maybee, a Principal Software Engineer on the C++ Cross-Platform Team. Accurate C++ IntelliSense requires access to the C++ headers that are referenced by C++ source files. For Linux scenarios the headers referenced by a Linux MSBuild or CMake project are copied to Windows by Visual Studio from the Linux device (or VM, or Docker container, or WSL system) being targeted for the build. Visual Studio then uses these headers to provide IntelliSense. If the headers are not the correct versions, for example they are gcc headers rather than clang headers, or C++11 headers rather tha...
C++ Inliner Improvements: The Zipliner
Visual Studio 2019 versions 16.3 and 16.4 include improvements to the C++ inliner. Among these is the ability to inline some routines after they have been optimized, referred to as the “Zipliner.” Depending on your application, you may see some minor code quality improvements and/or major build-time (compiler throughput) improvements. C2 Inliner Terry Mahaffey has provided an overview of Visual Studio’s inlining decisions. This details some of the inliner’s constraints and areas for improvement, a few of which are particularly relevant here: Modern C++ Unfortunately, many of the coding patte...
Debugging Linux CMake Projects with gdbserver
Update 2/20/20: We have addressed a bug which allows you to debug simple CMake projects using one level of CMakeLists.txt files with gdbserver in Visual Studio 2019 version 16.5 Preview 3. The example launch configuration has been updated below. Gdbserver is a program that allows you to remotely debug applications running on Linux. It is especially useful in embedded scenarios where your target system may not have the resources to run the full gdb. Visual Studio 2019 version 16.5 Preview 1 enables remote debugging of CMake projects with gdbserver. In our previous blog post we showed you how to build a C...
Build C++ Applications in a Linux Docker Container with Visual Studio
Docker containers provide a consistent development environment for building, testing, and deployment. The virtualized OS, file system, environment settings, libraries, and other dependencies are all encapsulated and shipped as one image that can be shared between developers and machines. This is especially useful for C++ cross-platform developers because you can target a container that runs a different operating system than the one on your development machine. In this blog post we’re going to use Visual Studio’s native CMake support to build a simple Linux application in a Linux docker container over SSH. This...
CMake Tools Extension for Visual Studio Code
Microsoft is now the primary maintainer of the CMake Tools extension for Visual Studio Code. The extension was created and previously maintained by vector-of-bool, who has moved on to other things. Thank you vector-of-bool for all of your hard work getting this extension to where it is today! About the extension The CMake Tools extension provides developers with a convenient and powerful workflow for configuring, building, browsing, and debugging CMake-based projects in Visual Studio Code. You can visit the CMake Tools documentation and the extension’s GitHub repository to get started and learn more. The fol...
Set Environment Variables for Debug, Launch, and Tools with CMake and Open Folder
There are many reasons why you may want to customize environment variables. Many build systems use environment variables to drive behavior; debug targets sometimes need to have PATH customized to ensure their dependencies are found; etc. Visual Studio has a mechanism to customize environment variables for debugging and building CMake projects and C++ Open Folder. In Visual Studio 2019 16.4 we made some changes to simplify this across Visual Studio’s JSON configuration files. This post is going to cover how to use this feature from the ground up with the new changes since not everyone may be familiar with how a...