開始以前
一、安裝rust
rust 安裝地址
shell
二、切換到json
msvc toolchain by rustup default stable-x86_64-pc-windows-msvcwindows
三、安裝VSCODE
VS Code 安裝地址
測試
安裝語言環境
- 安裝rls擴展
- 安裝Native Debug擴展
- 擴展rust-analyzer
搭建測試環境
- 在工程目錄下新建.vscode目錄
- 在新建的 .vscode 文件夾裏新建兩個文件 tasks.json 和 launch.json,文件內容以下:
tasks.json 文件ui
{ "version": "2.0.0", "tasks": [ { "label": "build", "type": "shell", "command":"cargo", "args": ["build"] } ] }
launch.json 文件(適用在 Windows 系統上)url
{ "version": "0.2.0", "configurations": [ { "name": "(Windows) 啓動", "preLaunchTask": "build", "type": "cppvsdbg", "request": "launch", "program": "${workspaceFolder}/target/debug/${workspaceFolderBasename}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false }, { "name": "(gdb) 啓動", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/target/debug/${workspaceFolderBasename}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "這裏填GDB所在的目錄", "setupCommands": [ { "description": "爲 gdb 啓用整齊打印", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] }
- 下載visualcppbuildtools_full.exe
下載地址
結尾
配置成功!!!!
spa