vs linux 交叉编译,在 Visual Studio 中部署、运行和调试 Linux MSBuild C++ 项目 | Microsoft Docs...

部署、运行和调试 Linux MSBuild 项目Deploy, run, and debug your Linux MSBuild project

08/08/2020

本文内容

Linux 支持在 Visual Studio 2017 及更高版本中提供。Linux support is available in Visual Studio 2017 and later. 若要查看这些版本的文档,请将目录上方的“版本”下拉列表设置为“Visual Studio 2017”或“Visual Studio 2019”。To see the documentation for these versions, set the Version drop-down located above the table of contents to Visual Studio 2017 or Visual Studio 2019.

在 Visual Studio 中创建基于 MSBuild 的 Linux C++ 项目,并使用 Linux 连接管理器连接到该项目后,即可运行和调试该项目。Once you've created a MSBuild-based Linux C++ project in Visual Studio and you've connected to the project using the Linux Connection Manager, you can run and debug the project. 在远程目标上编译、执行和调试代码。You compile, execute, and debug the code on the remote target.

Visual Studio 2019 版本 16.1:可以面向不同 Linux 系统进行调试和生成。Visual Studio 2019 version 16.1 You can target different Linux systems for debugging and building. 例如,可以在 x64 系统上进行交叉编译,并在定位 IoT 方案时部署到 ARM 设备。For example, you can cross-compile on x64 and deploy to an ARM device when targeting IoT scenarios. 有关详细信息,请参阅本文后面的指定用于生成和调试的不同计算机。

与 Linux 项目交互并对其进行调试方法有若干种。There are several ways to interact with and debug your Linux project.

使用 Visual Studio 传统功能(例如断点、监视窗口和悬停在变量上)进行调试。Debug using traditional Visual Studio features, such as breakpoints, watch windows, and hovering over a variable. 使用这些方法,可以像平常调试其他项目类型那样进行调试。Using these methods, you may debug as you normally would for other project types.

从 Linux 控制台窗口中的目标计算机查看输出。View output from the target computer in the Linux Console window. 还可以使用控制台将输入发送到目标计算机。You can also use the console to send input to the target computer.

调试 Linux 项目Debug your Linux project

在“调试”属性页中选择调试模式。Select debugging mode in the Debugging property page.

GDB 用于调试在 Linux 上运行的应用程序。GDB is used to debug applications running on Linux. 在远程系统(而非 WSL)上进行调试时,GDB 可以在两种不同的模式下运行,可从项目“调试”属性页中的“调试模式”选项中进行选择:When debugging on a remote system (not WSL) GDB can run in two different modes, which can be selected from the Debugging Mode option in the project's Debugging property page:

vs linux 交叉编译,在 Visual Studio 中部署、运行和调试 Linux MSBuild C++ 项目 | Microsoft Docs..._第1张图片

GDB 用于调试在 Linux 上运行的应用程序。GDB is used to debug applications running on Linux. GDB 能以两种不同的模式运行,可从项目“调试”属性页中的“调试模式”选项中进行选择:GDB can run in two different modes, which can be selected from the Debugging Mode option in the project's Debugging property page:

vs linux 交叉编译,在 Visual Studio 中部署、运行和调试 Linux MSBuild C++ 项目 | Microsoft Docs..._第2张图片

在 gdbserver 模式下,GDB 在本地运行,连接到在远程系统上的 gdbserver。In gdbserver mode, GDB is run locally, which connects to gdbserver on the remote

你可能感兴趣的:(vs,linux,交叉编译)