CppPilot

Practical guide Visual Studio C++

Upgrade an old C++ project to a newer Visual Studio

Opening an old solution in a new Visual Studio is the easy part. The new toolset is stricter, some old libraries no longer link, and settings that once were defaults are now outdated. Upgrade step by step.

Applies toVisual Studio MSBuild C++ projects (.vcxproj)
ExamplesFocused excerpts; required context is stated alongside each example

Visual Studio property-page paths describe MSBuild projects. For CMake, configure the corresponding target or preset. Menu names can vary by Visual Studio version; use the cited reference for your toolset.

VideoFilmed in Visual Studio with a demo project. English narration, with subtitles in English, French, German, Italian and Spanish.
Transcript

The outdated settings of a C++ project, found and modernized by CppPilot in Visual Studio. Archive is an old project: C++14, conformance mode off, and the deprecated Minimal Rebuild option in Debug.

Choose Extensions > CppPilot > Project & Solution > Build Performance and Modernization. CppPilot reads the settings of every configuration, and the AI checks each modernization candidate.

Three findings: remove Minimal Rebuild, /Gm, which only produces warning D9035; move to a current C++ standard; and turn conformance mode on. Click Fix review findings.

The AI sets C++17 and conformance mode for both configurations, and turns Minimal Rebuild off. Build again: the code still builds with the stricter settings.

Test the program before you raise the standard further. CppPilot explains and fixes C++ build errors in Visual Studio.

How it worksUpgrade in stages
  1. BaselineKeep the previous build
  2. RetargetInstalled toolset + SDK
  3. RebuildCode and dependencies
  4. TestCheck runtime behavior

Keep a working baseline and test after each stage so a new failure can be traced to the change that introduced it.

Retarget the toolset and the SDK

Right-click the solution and choose Retarget solution, or set General > Platform Toolset (v143 for Visual Studio 2022) and General > Windows SDK Version (10.0 (latest installed version)) in every project and configuration. A toolset or SDK that is not installed causes MSB8020 or MSB8036.

Project from an older environment

Platform Toolset: v142Windows SDK Version: 10.0.17763.0// Neither is installed on this machine.

Example target: Visual Studio 2022

Platform Toolset: v143Windows SDK Version: 10.0 (latest installed)// Select versions installed on your machine.
ExampleThis is a retargeting example, not a requirement to move every project to v143. Install pinned tools when the project must retain them.

Fix the stricter compiler

Newer compilers follow the standard more closely, and new projects turn conformance mode (/permissive-) on. Expect errors on code that older versions accepted:

  • string literals assigned to char* (C2440);
  • missing typename before dependent types in templates (C2061);
  • functions removed from the standard: std::auto_ptr, std::random_shuffle, and std::bind1st are gone in C++17;
  • unsafe C runtime functions reported as deprecated (C4996).

Fix them rather than turning conformance off: the code becomes portable and ready for newer standards.

Code rejected in conformance mode

char* label = "Hello";// String literals are read-only.

Keep the read-only type

const char* label = "Hello";// Use std::string if you need mutable text.
ExampleCorrect the type instead of disabling conformance mode to keep the old conversion.

Raise the C++ standard

MSVC compiles C++14 by default. Set C/C++ > Language > C++ Language Standard to C++17 or C++20 to use std::filesystem, std::optional, and newer features, in every project of the solution.

Rebuild old libraries

MSVC libraries built with Visual Studio 2015 to 2026 have a binary-compatibility guarantee with restrictions. The linker and Redistributable must be at least as recent as the newest input's build tools. Objects and static libraries compiled with /GL or used with /LTCG require exactly matching build tools, including minor versions; otherwise a rebuild may be needed. See Microsoft's compatibility rules.

Libraries built with Visual Studio 2013 or older do not have this guarantee and generally need rebuilding. They can reference C runtime functions that no longer exist (LNK2019 on __iob_func or sprintf). legacy_stdio_definitions.lib restores the old printf family, but rebuilding is the lasting fix.

Review project settings with CppPilot

Right-click the solution and choose CppPilot > Build Performance and Modernization: CppPilot lists old toolsets, the Windows 8.1 SDK, C++14, conformance mode off, and inconsistent settings between projects. Then build and choose Fix all errors to request corrections from the selected AI. CppPilot rebuilds the relevant project to check which errors remain.

Sources and scope

Official references

These links document the compiler, build system, or debugger behavior discussed here. Use the version selector on Microsoft Learn for your toolset. Example blocks are focused excerpts; required headers and build settings are stated alongside them.

Using CppPilot in Visual Studio

CppPilot connects your own Codex or Claude account to Visual Studio. If you have neither, CppPilot Cloud provides AI access for build fixes, reviews, crash analysis, and project checks. AI chat requires your own Codex or Claude account.

Setup instructions · Visual Studio Marketplace