VS Code 疑難雜症
unresolved import 'xyz'
VS code 出現警示
- 修改 Cargo.toml
- 增加相關所需的 dependencies
[dependencies]
rand="0.8.5"
compile 時出錯的話
- install Code Runner extension
- 點齒輪 > Extension Settings > Executor Map setting
- link 'Edit in settings.json
- 下列修改..... 無效(因為原本便是用 cargo run)
from :
"code-runner.executorMap": {
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
}
to:
"code-runner.executorMap": {
"rust": "cargo run # $fileName",
}
use of undeclared crate or module