Visual Studio 中的 C++C++ in Visual Studio

备注

此开发人员文档适用于 Visual Studio 2019。This developer documentation applies to Visual Studio 2019. 若要查看 Visual Studio 首选项的文档,请使用“版本”选择器控件。To see the documentation for your preferred version of Visual Studio, use the Version selector control. 它位于此页面上目录表的顶部。It's found at the top of the table of contents on this page.

如果要查找 Microsoft Visual C++ 2019 可再发行包以便运行程序,请转到 Microsoft Visual Studio 网站的下载页面。If you're looking for a Microsoft Visual C++ 2019 redistributable package so that you can run a program, go to the Microsoft Visual Studio site's Downloads page. 在“所有下载”下,展开“其他工具、框架和可再发行组件”部分。Under All Downloads , expand the Other Tools, Frameworks, and Redistributables section. 选择目标体系结构,然后选择“下载”按钮。Select your target architecture, then choose the Download button.

对于更早的可再发行组件,请打开更早的下载页面。For older redistributables, open the Older downloads page. 展开“其他工具、框架和可再发行组件”部分。Expand the Other Tools, Frameworks, and Redistributables section. 找到要下载的可再发行版本,选择目标体系结构,然后选择“下载”按钮。Find the redistributable version you want to download, select your target architecture, then choose the Download button.

备注

此开发人员文档适用于 Visual Studio 2017。This developer documentation applies to Visual Studio 2017. 若要查看 Visual Studio 首选项的文档,请使用“版本”选择器控件。To see the documentation for your preferred version of Visual Studio, use the Version selector control. 它位于此页面上目录表的顶部。It's found at the top of the table of contents on this page.

如果要查找 Microsoft Visual C++ 2017 或更早版本的可再发行包来运行程序,请转到 Microsoft Visual Studio 网站的更早的下载页面。If you're looking for a Microsoft Visual C++ 2017 or older redistributable package so that you can run a program, go to the Microsoft Visual Studio site's Older downloads page. 展开“其他工具、框架和可再发行组件”部分。Expand the Other Tools, Frameworks, and Redistributables section. 找到要下载的可再发行版本,选择目标体系结构,然后选择“下载”按钮。Find the redistributable version you want to download, select your target architecture, then choose the Download button.

备注

此开发人员文档适用于 Visual Studio 2015。This developer documentation applies to Visual Studio 2015. 若要查看 Visual Studio 首选项的文档,请使用“版本”选择器控件。To see the documentation for your preferred version of Visual Studio, use the Version selector control. 它位于此页面上目录表的顶部。It's found at the top of the table of contents on this page.

如果要查找 Microsoft Visual C++ 2015 或更早版本的可再发行包来运行程序,请转到 Microsoft Visual Studio 网站的更早的下载页面。If you're looking for a Microsoft Visual C++ 2015 or older redistributable package so that you can run a program, go to the Microsoft Visual Studio site's Older downloads page. 展开“其他工具、框架和可再发行组件”部分。Expand the Other Tools, Frameworks, and Redistributables section. 找到要下载的可再发行版本,选择目标体系结构,然后选择“下载”按钮。Find the redistributable version you want to download, select your target architecture, then choose the Download button.

Microsoft Visual C++ (MSVC) 是 Windows Visual Studio 的一部分,指 C++、C 和汇编语言开发工具和库。Microsoft Visual C++ (MSVC) refers to the C++, C, and assembly language development tools and libraries available as part of Visual Studio on Windows. 这些工具和库可用于创建通用 Windows 平台 (UWP) 应用、本机 Windows 桌面和服务器应用程序、在 Windows、Linux、Android 和 iOS 上运行的跨平台库和应用以及使用 .NET Framework 的托管应用和库。These tools and libraries let you create Universal Windows Platform (UWP) apps, native Windows desktop and server applications, cross-platform libraries and apps that run on Windows, Linux, Android, and iOS, as well as managed apps and libraries that use the .NET Framework. 从 Windows 桌面的简单控制台应用到最复杂的应用,从移动设备的设备驱动程序和操作系统组件到跨平台游戏,再从 Azure 云中的最小 IoT 设备到多服务器的高性能计算等所有内容都可以使用 MSVC 编写。You can use MSVC to write anything from simple console apps to the most sophisticated and complex apps for Windows desktop, from device drivers and operating system components to cross-platform games for mobile devices, and from the smallest IoT devices to multi-server high performance computing in the Azure cloud.

可以并行安装 Visual Studio 2015、2017 和 2019。Visual Studio 2015, 2017 and 2019 can be installed side-by-side. 可以结合使用 Visual Studio 2019(编译器工具集 v142)或 Visual Studio 2017 (v141) 与 Visual Studio 2017 (v141) 和 Visual Studio 2015 (v140) 中的工具集来编辑和生成程序。You can use Visual Studio 2019 (compiler toolset v142) or Visual Studio 2017 (v141) to edit and build programs using the toolset from Visual Studio 2017 (v141) and Visual Studio 2015 (v140).

新增功能和符合性历史记录What's New and Conformance History

Visual Studio 中 C++ 的新增功能What's New for C++ in Visual Studio
了解 Visual Studio 中的新增功能。Find out what's new in Visual Studio.

Visual Studio 2003 到 2015 中 C++ 的新增功能What's New for C++ in Visual Studio 2003 through 2015
Visual Studio 2003 到 2015 每个版本中的 C++ 新增功能。Find out what was new in C++ for each version of Visual Studio from 2003 through 2015.

Visual Studio 中的 C++ 符合性改进C++ conformance improvements in Visual Studio
了解 Visual Studio 中 C++ 的符合性改进情况。Learn about C++ conformance improvements in Visual Studio.

Microsoft C++ 语言符合性表Microsoft C++ language conformance table
MSVC C++ 编译器中按功能列出的符合性状态列表。A list of conformance status by feature in the MSVC C++ compiler.

Microsoft C/C++ 更改历史记录 2003 - 2015Microsoft C/C++ change history 2003 - 2015
了解先前版本中的重大更改。Learn about the breaking changes in previous versions.

安装 Visual Studio 并从早期版本升级Install Visual Studio and upgrade from earlier versions

在 Visual Studio 中安装 C++ 支持Install C++ support in Visual Studio
下载 Visual Studio 并安装 Microsoft C/C++ 工具集。Download Visual Studio and install the Microsoft C/C++ toolset.

Microsoft C++ 移植和升级指南Microsoft C++ porting and upgrading guide
移植代码并将项目升级到 Visual Studio 2015 或更高版本的指南,以利用更高的编译器 C++ 标准符合性,以及大幅改进的编译时间和安全功能(例如 Spectre 缓解)。Guidance for porting code and upgrading projects to Visual Studio 2015 or later to take advantage of greater compiler conformance to the C++ standard as well as greatly improved compilation times and security features such as Spectre mitigation.

Visual Studio 版本中的 C++ 工具和功能C++ tools and features in Visual Studio editions
查明不同的 Visual Studio 版本。Find out about different Visual Studio editions.

支持的平台Supported platforms
了解 Microsoft C/C++ 编译器支持哪些平台。Find out which platforms the Microsoft C/C++ compiler supports.

了解 C++Learn C++

欢迎回到 C++Welcome back to C++
基于可使你快速、安全地编写代码并避免 C 样式编程的多个缺陷的 C++11 及更高版本,了解有关现代 C++ 编程技术的详细信息。Learn more about modern C++ programming techniques based on C++11 and later that enable you to write fast, safe code and avoid many of the pitfalls of C-style programming.

标准 C++Standard C++
了解 C++、获取现代 C++ 的概述,并查找各种书籍、文章、谈话和会议的链接Learn about C++, get an overview of Modern C++, and find links to books, articles, talks, and events

了解 Visual Studio 并开发你的第一个 C++ 项目Learn Visual Studio and make your first C++ project
开始学习如何在 Visual Studio 中编写 C++。Start learning how to write C++ in Visual Studio.

Visual Studio C++ 示例Visual Studio C++ samples
有关 Microsoft 提供的 C++ 代码示例的信息。Information about the C++ code samples provided by Microsoft.

C++ 开发工具C++ development tools

Visual Studio 中的 C++ 开发概述Overview of C++ development in Visual Studio
如何使用 Visual Studio IDE 来创建项目、编辑代码、链接到库、编译、调试、创建单元测试、执行静态分析、部署等。How to use the Visual Studio IDE to create projects, edit code, link to libraries, compile, debug, create unit tests, do static analysis, deploy, and more.

项目和生成系统Projects and build systems
如何使用 MSVC 编译器和链接器选项创建和配置 Visual Studio C ++ 项目、CMake 项目和其他类型的项目。How to create and configure Visual Studio C++ projects, CMake projects, and other kinds of projects with MSVC compiler and linker options.

编写和重构 C++ 代码Writing and refactoring C++ code
如何使用 C++ 编辑器中的高效工作功能来重构、导航、理解和编写代码。How to use the productivity features in the C++ editor to refactor, navigate, understand and write code.

调试本机代码Debugging native code
在 C++ 项目中使用 Visual Studio 调试器。Use the Visual Studio debugger with C++ projects.

C/C++ 代码分析概述Code analysis for C/C++ overview
使用 SAL 注释或 C++ Core Guidelines 检查器执行静态分析。Use SAL annotations or the C++ Core Guidelines checkers to perform static analysis.

在 Visual Studio 中编写 C/C++ 单元测试Write unit tests for C/C++ in Visual Studio
使用面向 C++、Google Test、Boost.Test,或 CTest 的 Microsoft 单元测试框架创建单元测试。Create unit tests using the Microsoft Unit Testing Framework for C++, Google Test, Boost.Test, or CTest.

使用 C++ 编写应用程序Write applications in C++

通用 Windows 应用 (C++)Universal Windows Apps (C++)
在 Windows 开发人员中心查找指南和参考内容。Find guides and reference content on the Windows Developer Center. 有关开发 UWP 应用的信息,请参阅通用 Windows 平台简介使用 C++ 创建第一个 UWP 应用For information about developing UWP apps, see Intro to the Universal Windows Platform and Create your first UWP app using C++.

桌面应用程序 (C++)Desktop applications (C++)
了解如何创建适用于 Windows 的传统本机 C++ 桌面应用程序。Learn how to create traditional native C++ desktop applications for Windows.

使用 C++/CLI 进行 .NET 编程.NET programming with C++/CLI
了解如何创建 DLL,在本机 C++ 和以 C# 或 Visual Basic 等语言编写的 .NET 程序之间实现互操作性。Learn how to create DLLs that enable interoperability between native C++ and .NET programs written in languages such as C# or Visual Basic.

Linux 编程Linux programming
使用 Visual Studio IDE 编写代码,并将其部署到远程 Linux 计算机上,以便使用 GCC 进行编译。Use the Visual Studio IDE to code and deploy to a remote Linux machine for compilation with GCC.

在 Visual Studio 中创建 C/C++ DLLCreate C/C++ DLLs in Visual Studio
查明如何使用 Win32、ATL 和 MFC 创建 Windows 桌面 DLL,并提供有关如何编译和注册 DLL 的信息。Find out how to use Win32, ATL, and MFC to create Windows desktop DLLs, and provides information about how to compile and register your DLL.

并行编程Parallel programming
了解如何使用并行模式库、C++ AMP、OpenMP 以及与 Windows 多线程相关的其他功能。Learn how to use the Parallel Patterns Library, C++ AMP, OpenMP, and other features that are related to multithreading on Windows.

安全性最佳做法Security best practices
了解如何保护应用程序免受恶意代码威胁和未经授权的使用。Learn how to protect applications from malicious code and unauthorized use.

云和 Web 编程Cloud and web programming
C++ 中有多种选项可使你连接到 Web 和云。In C++, you have several options for connecting to the web and the cloud.

数据访问Data access
使用 ODBC 和 OLE DB 连接到数据库。Connect to databases using ODBC and OLE DB.

文本和字符串Text and strings
了解有关处理不同的文本和字符串格式以及针对本地和国际开发编码的信息。Learn about working with different text and string formats and encodings for local and international development.

语言参考Languages reference

C++ 语言参考C++ language reference
C++ 编程语言 Microsoft 实现的参考指南。The reference guide to the Microsoft implementation of the C++ programming language.

C/C++ 预处理器参考C/C++ preprocessor reference
共享 C 和 C++ 语言预处理器的常见参考。A common reference to the shared C and C++ language preprocessor.

C 语言参考C language reference
C 编程语言 Microsoft 实现的参考指南。The reference guide to the Microsoft implementation of the C programming language.

编译器内部函数和程序集语言Compiler intrinsics and assembly language
每个平台上的 Microsoft C/C++ 编译器支持或实现的编译器内部函数的指南。Guides to the compiler intrinsics supported or implemented by the Microsoft C/C++ compilers on each platform.

Visual Studio 中的 C++ 库C++ Libraries in Visual Studio

以下各节提供了有关 Visual Studio 中不同 C 和 C++ 库的信息。The following sections provide information about the different C and C++ libraries that are included in Visual Studio.

C 运行时库参考C runtime library reference
包括用安全性增强的函数来替代已知会引起安全问题的函数。Includes security-enhanced alternatives to functions that are known to pose security issues.

C++ 标准库C++ standard library
C++ 标准库。The C++ Standard Library.

活动模板库 (ATL)Active Template Library (ATL)
对 COM 组件和应用的支持。Support for COM components and apps.

Microsoft 基础类 (MFC) 库Microsoft Foundation Class (MFC) libraries
对创建具有传统或 Office 样式用户界面的桌面应用的支持。Support for creating desktop apps that have traditional or Office-style user interfaces.

并行模式库 (PPL)Parallel Patterns Library (PPL)
在 CPU 上执行的异步和并行算法。Asynchronous and parallel algorithms that execute on the CPU.

C++ AMP (C++ Accelerated Massive Parallelism)C++ AMP (C++ Accelerated Massive Parallelism)
在 GPU 上执行的大量并行算法。Massively parallel algorithms that execute on the GPU.

Windows 运行时模板库 (WRL)Windows Runtime Template Library (WRL)
通用 Windows 平台 (UWP) 应用和组件。Universal Windows Platform (UWP) apps and components.

使用 C++/CLI 进行 .NET 编程.NET programming with C++/CLI
公共语言运行时 (CLR) 编程。Programming for the common language runtime (CLR).

第三方开源 C++ 库Third-party open source C++ libraries

跨平台 vcpkg 命令行工具,可以显著简化 900 多个 C++ 开源库的发现和安装操作。The cross-platform vcpkg command-line tool greatly simplifies the discovery and installation of over 900 C++ open source libraries. 请参阅 vcpkg:用于 Windows 的 C++ 程序包管理器See vcpkg: C++ Package Manager for Windows.

反馈和社区Feedback and community

Microsoft Docs 问答Microsoft Docs Q&A
Microsoft Docs 提供了包含问题和解答的可搜索论坛。Microsoft Docs hosts searchable forums for questions and answers. C++ 标记添加到帖子内容中,以便获得 C++ 相关问题的社区帮助。Add a C++ tag to your post for community assistance on C++-related issues.

如何使用 Microsoft C/C++ 工具集报告问题How to report a problem with the Microsoft C/C++ toolset
了解如何针对 Microsoft C/C++ 工具集(编译器、链接器和其他工具)创建有效的错误报告,以及提交报告的方法。Learn how to create effective error reports against the Microsoft C/C++ toolset (compiler, linker, and other tools), and ways to submit your report.

Microsoft C++ 团队博客Microsoft C++ Team Blog
从开发人员角度详细了解 Visual Studio 中 C++ 工具的新功能和最新信息。Learn more about new features and the latest information from the developers of the C++ tools in Visual Studio.

Visual Studio C++ 开发人员社区Visual Studio C++ Developer Community
获取帮助、报告 Bug,并提出 Visual Studio C++ 建议。Get help, file bugs, and make suggestions for C++ in Visual Studio.