WSL (Linux)配置 Rust 开发调试环境

WSL (Linux)配置 Rust 开发调试环境

  1. 安装 Rust:安装 Rust 环境 - Rust语言圣经(Rust Course)

    除了执行以上步骤,还得安装编译工具:

    bash 复制代码
    sudo apt-get update
    sudo apt-get install build-essential
  2. 配置 VSCode:墙推 VSCode! - Rust语言圣经(Rust Course)

  3. 安装调试工具:

    bash 复制代码
    sudo apt install lldb

    安装 CodeLLDB 插件,如果有报错,根据报错提示下载好.VSIX文件以后使用Install from VSIX...的 VSCode 命令。

    在项目目录下命令行运行cargo build命令构建调试用二进制文件。

    按 F5 运行调试,如果报错,则根据提示配置launch.json文件,比如:

    json 复制代码
    {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "type": "lldb",
                "request": "launch",
                "name": "Debug",
                "program": "${workspaceFolder}/target/debug/<executable_file>",
                "args": [],
                "cwd": "${workspaceFolder}"
            }
        ]
    }
相关推荐
程序员JerrySUN12 分钟前
关注 Yocto项目实战教程
运维·数据库·嵌入式硬件·缓存
IvanCodes21 分钟前
一、初识 Linux 与基本命令
大数据·linux·运维
muzi_liii26 分钟前
40+个常用的Linux指令——下
linux
wanhengidc38 分钟前
服务器分布式的作用都有什么?
运维·服务器·分布式
勤匠1 小时前
在CentOS上以源码编译的方式安装PostgreSQL
linux·postgresql·centos
Arvin6271 小时前
Linux 完整删除 Systemd 服务的步骤
linux·服务器
猫猫的小茶馆1 小时前
【STM32】FreeRTOS 消息队列(五)
linux·stm32·单片机·嵌入式硬件·51单片机·智能硬件·pcb工艺
老实巴交的麻匪1 小时前
Logs 可观测性 | Grafana Loki 架构窥探与实践
运维·云原生·容器
coder_lorraine1 小时前
【Linux系列】Linux文件类型大揭秘:不只是文件与文件夹的奇幻世界!
linux
MarkGosling2 小时前
【开源项目】轻量加速利器 HubProxy 自建 Docker、GitHub 下载加速服务
运维·git·docker·容器·开源·github·个人开发