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

本文介绍了如何在 Visual Studio 2017 及更高版本中使用 MSBuild 创建 Linux C++ 项目,并进行部署、运行和调试。在远程目标上进行编译、执行和调试代码,支持在不同 Linux 系统上进行调试和生成。Visual Studio 提供了多种调试方式,包括使用断点、监视窗口和 Linux 控制台窗口。同时,可以配置调试选项,如程序参数、GDB 路径等,并支持附加到远程进程进行调试。此外,从版本 16.1 开始,可以指定不同的远程生成和调试计算机,实现更灵活的开发流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

部署、运行和调试 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:

e794957a8b779b342f6c598e83b34686.png

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:

a68dfc38b4131a152078a9b0fa0b3151.png

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值