首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我的新Rust项目会将可执行文件发送到以前的项目target/debug & target/release文件夹?

为什么我的新Rust项目会将可执行文件发送到以前的项目target/debug & target/release文件夹?
EN

Stack Overflow用户
提问于 2020-06-14 14:16:18
回答 1查看 110关注 0票数 0

我在Ubuntu18.04上的VSCode Rust项目的路径是~/Documents/VSCode_Projects/VSCode_Rust_Projects

在VSCode_Rust_Projects文件夹中,我有两个工作正常的项目。

我刚刚在文件夹VSCode_Rust_Projects中创建了第三个新项目,由于某种原因,当我将cargo build作为任务在集成开发环境中执行时,调试可执行文件会被发送到上一个项目的目标/调试folder...so文件夹,而不会在当前项目的工作文件夹中生成目标/调试文件夹。为什么??

任务配置为:

代码语言:javascript
复制
{
    "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"
        }
    ]
}

我被难住了!我无法在我的新项目中生成目标文件夹。

EN

回答 1

Stack Overflow用户

发布于 2020-06-15 08:26:30

在上一个项目中,我忘记设置了CARGO_TARGET_DIR cargo环境变量,并将其保存在.bashrc文件中。设置此选项将导致所有构建被放置在指定的目录中;注释掉该设置并执行"source ~/.bashrc“可以修复所有问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62369036

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档