C++ Team Blog
The latest in C++, Visual Studio, VS Code, and vcpkg from the MSFT C++ team
Latest posts
Spectre diagnostic in Visual Studio 2017 Version 15.7 Preview 4
Visual Studio 2017 version 15.7 Preview 4 adds a new capability to our Spectre mitigation: the ability to see where the compiler would have inserted a mitigation and what data led to that action. A new warning, C5045, lets you see what patterns in your code would have caused a mitigation, such as an LFENCE, to be inserted. This change builds upon our existing Spectre mitigation support, including the changes introduced in Preview 3. Complete details about are available in context in the original MSVC Spectre mitigation post on VCBlog. The new warning is also discussed below. Enabling C5045 The C5045 warning ...
IntelliSense for Remote Linux Headers
In Visual Studio 2017 15.7 Preview 3 we are introducing IntelliSense for headers on remote Linux connections. This is part of the Linux development with C++ workload that you can choose in the Visual Studio installer. If you are just getting started with the C++ Linux support in Visual Studio you can read our C++ Linux tutorial at aka.ms/vslinux. When you add a new connection in the Connection Manager we will automatically determine the include directories for the compiler on the system. Those directories will be zipped up and copied to a directory on your local Windows machine. Then, when you use that connectio...
Announcing CodeLens for C++ Unit Testing
If you are just getting started with unit testing in C++, visit our testing startup guide. C++ developers in Visual Studio can now get their first taste of CodeLens! Specifically, Visual Studio 2017 15.7 Preview 3 Professional and Enterprise editions offer CodeLens for Unit Testing. There are a few ways to initialize CodeLens: After performing any of the above actions, CodeLens will appear above each of your unit tests. CodeLens allows you to Run, Debug, and view the Test Status of your unit tests directly in the source file. The test status indicators are the same as the ones in the Test Explorer (W...
CMake Support in Visual Studio – Targets View, Single File Compilation, and Cache Generation Settings
Visual Studio 2017 15.7 Preview 3 is now available, which includes several improvements to the CMake tools. The latest preview offers more control than ever over how to visualize, build, and manage your CMake projects. Please download the preview and check out the latest CMake features such as the Targets View, single file compilation, and more control over when projects are configured. As always, we would love to hear your feedback too. If you are new to CMake in Visual Studio, check out how to get started. CMake Targets View The latest preview of Visual Studio offers a new way to visualize your CMake project...
Spectre mitigation changes in Visual Studio 2017 Version 15.7 Preview 3
With Visual Studio 2017 version 15.7 Preview 3 we have two new features to announce with regards to our Spectre mitigations. First, the /Qspectre switch is now supported regardless of the selected optimization level. Second, we have provided Spectre-mitigated implementations of the Microsoft Visual C++ libraries. Complete details are available in context in the original MSVC Spectre mitigation post on VCBlog. Changes in Update 3 are also listed below. In previous versions of MSVC we only added Spectre mitigations when code is being optimized. In Visual Studio 2017 version 15.7 Preview 3 we've added support for ...
C++ code analysis: configure rules from the command line
This post written by Sunny Chatterjee and Andrew Pardoe Visual Studio version 15.7 Preview 3 introduces a new MSVC compiler switch, , that configures code analysis runs. The primary motivation for this switch is to enable developers who are using C++ Code Analysis without using MSBuild to filter rules. But developers who are using code analysis with MSBuild also benefit from this switch: code analysis runs are faster, increasing your compilation throughput. What are code analysis rulesets? Code analysis rulesets allow you to choose what code analysis results you see when you analyze your code. Code analysis rule...
MSVC now correctly reports __cplusplus
The MSVC compiler’s definition of the predefined macro leaps ahead 20 years in Visual Studio 2017 version 15.7 Preview 3. This macro has stubbornly remained at the value "199711L", indicating (erroneously!) that the compiler conformed to the C++98 Standard. Now that our conformance catch-up work is drawing to a close we’re updating the macro to reflect the true state of our implementation. The value of the macro doesn’t imply that we no longer have any conformance bugs. It’s just that the new value is much more accurate than always reporting "199711L". /Zc:__cplusplus You need to compile with the switch to ...
Visual Studio Code C/C++ extension March 2018 update
Today we are excited to announce the March 2018 update to the Visual Studio Code C/C++ extension! This update includes improved auto-complete for local and global scopes and a simplified configuration process for system includes and defines, enabling a better out-of-box IntelliSense experience. You can find the full list of changes in the release notes. We’d like to thank everyone who tried our Insiders builds earlier this month and sent us feedback! Fixes for the issues you reported and feature suggestions you told us about helped shape the final release the way it is today 😊. If you are not yet an insider but ...
Configuring C++ IntelliSense and Browsing
Whether you are creating a new (or modifying an existing) C++ project using a Wizard, or importing an project into Visual Studio from another IDE, it’s important to configure the project correctly for the IntelliSense and Browsing features to provide accurate information. This article provides some tips on configuring the projects and describes a few ways that you can investigate configuration problems. Include Paths and Preprocessor Macros The two settings that have the greatest effect on the accuracy of IntelliSense and Browsing operations are the Include Paths and the Preprocessor macros. This is especially ...