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}"
            }
        ]
    }
相关推荐
阿里云大数据AI技术4 分钟前
阿里云 EMR AI 助手正式发布:从问答工具到全栈智能运维助手
运维·人工智能
花褪残红青杏小4 小时前
Rust图像处理第11节-故障风 RGB 通道偏移:错位错色制造电子故障
rust·webassembly·图形学
花褪残红青杏小5 小时前
Rust图像处理第10节-浮雕/雕刻滤镜:邻域差值生成凹凸效果
rust·webassembly·图形学
Rockbean6 小时前
10分钟Solana-性能web3-2.4 Rust 编程基础三:结构体、枚举、错误处理与集合
rust·web3·智能合约
doiito7 小时前
【Agent Harness】Gliding Horse 上下文感知与智能压缩:让 Agent 的“注意力”永不偏移
ai·rust·架构设计·系统设计·ai agent
orion5718 小时前
Missing Semester Class1:course overview and introduction of shell
linux
SkyWalking中文站1 天前
认识 Horizon UI · 6/17:Trace 探索器
运维·监控·自动化运维
用户120487221611 天前
Linux驱动编译与加载
linux·嵌入式
火车叼位1 天前
写给初级开发者:SSL、SSH、HTTPS 与证书体系全解析
运维