自学内容网 自学内容网

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

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}"
            }
        ]
    }
    

原文地址:https://blog.csdn.net/Truman_Chan/article/details/142618743

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!