我在Ubuntu18.04上的VSCode Rust项目的路径是~/Documents/VSCode_Projects/VSCode_Rust_Projects。
在VSCode_Rust_Projects文件夹中,我有两个工作正常的项目。
我刚刚在文件夹VSCode_Rust_Projects中创建了第三个新项目,由于某种原因,当我将cargo build作为任务在集成开发环境中执行时,调试可执行文件会被发送到上一个项目的目标/调试folder...so文件夹,而不会在当前项目的工作文件夹中生成目标/调试文件夹。为什么??
任务配置为:
{
"version": "2.0.0",
"tasks": [
{
"type": "cargo",
"command": "build",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "rust: cargo build"
},
{
"type": "cargo",
"command": "check",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "rust: cargo check"
},
{
"type": "cargo",
"command": "clean",
"problemMatcher": [
"$rustc"
],
"group": "none",
"label": "rust: cargo clean"
},
{
"type": "cargo",
"command": "run",
"problemMatcher": [
"$rustc"
],
"label": "rust: cargo run"
},
{
"type": "cargo",
"command": "test",
"problemMatcher": [
"$rustc"
],
"group": "test",
"label": "rust: cargo test"
},
{
"type": "cargo",
"command": "build",
"args": [
"--release"
],
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "rust: cargo build --release"
}
]
}我被难住了!我无法在我的新项目中生成目标文件夹。
发布于 2020-06-15 08:26:30
在上一个项目中,我忘记设置了CARGO_TARGET_DIR cargo环境变量,并将其保存在.bashrc文件中。设置此选项将导致所有构建被放置在指定的目录中;注释掉该设置并执行"source ~/.bashrc“可以修复所有问题。
https://stackoverflow.com/questions/62369036
复制相似问题