C++ Team Blog

The latest in C++, Visual Studio, VS Code, and vcpkg from the MSFT C++ team

Latest posts

Apr 9, 2018
Post comments count 0
Post likes count 0

Announcing CodeLens for C++ Unit Testing

Nick Uhlenhuth

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...

Apr 9, 2018
Post comments count 0
Post likes count 0

CMake Support in Visual Studio – Targets View, Single File Compilation, and Cache Generation Settings

Will Buik

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...

Apr 9, 2018
Post comments count 0
Post likes count 0

Spectre mitigation changes in Visual Studio 2017 Version 15.7 Preview 3

Andrew Pardoe

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 ...

Apr 9, 2018
Post comments count 0
Post likes count 0

C++ code analysis: configure rules from the command line

Andrew Pardoe

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...

Apr 9, 2018
Post comments count 3
Post likes count 0

MSVC now correctly reports __cplusplus

Andrew Pardoe

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 ...

Mar 29, 2018
Post comments count 0
Post likes count 0

Visual Studio Code C/C++ extension March 2018 update

Rong Lu

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 ...

Mar 27, 2018
Post comments count 0
Post likes count 0

Configuring C++ IntelliSense and Browsing

Oleg Kharitonov

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 ...

Mar 22, 2018
Post comments count 0
Post likes count 0

C++ Core Checks in Visual Studio 2017 15.7 Preview 2

Sunny Chatterjee

This post was written by Sergiy Oryekhov. The C++ Core Guidelines Check extension received several new rules in Visual Studio 2017 15.7 Preview 2. The primary focus in this iteration was on the checks that would make it easier to adopt utilities from the Guidelines Support Library. Below is a quick summary of these additions. For more detailed information please see documentation on MSDN: C++ Core Guidelines Checker Reference. If you're just getting started with native code analysis tools, take a look at our introductory Quick Start: Code Analysis for C/C++. New rule sets There is one new rule category added in...

Mar 14, 2018
Post comments count 0
Post likes count 0

Build Time Improvement Recommendation: Turn off /MAP, use PDBs

YongKang Zhu [MSFT]

点这里看中文版 Map file is a plaintext file that contains information about where certain names and symbols exist in a binary produced by the linker. It also contain detailed information on all sections in your binary (code, data, etc.) and which OBJ/LIB each symbol is defined in. The Windows debuggers (like windbg.exe) can use map files to help locate where a program crashed based on a crash address. Map files are an old technology: with modern releases of the MSVC toolset, PDB (Program Database) files do everything map files do and more. Producing a map file takes a long time. If you see the linker switch /MAP in yo...