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

  1. 安装 Rust:安装 Rust 环境 - Rust语言圣经(Rust Course)
    除了执行以上步骤,还得安装编译工具:

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

  3. 安装调试工具:

    sudo apt install lldb
    

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

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

    按 F5 运行调试,如果报错,则根据提示配置launch.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}"
            }
        ]
    }
    

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部