gpt4 book ai didi

使用rust "extern mod std;"失败

转载 作者:行者123 更新时间:2023-11-29 08:04:26 24 4
gpt4 key购买 nike

我开始了“Rust for ruby​​ists”教程,这段代码让我感到困惑:

extern mod std;

#[test]
fn this_tests_code() {
println("")
}

fn main() {
}

尝试编译这个给了我:

> rustc testing.rs
testing.rs:1:0: 1:0 error: multiple matching crates for `core`
testing.rs:1 extern mod std;
^
note: candidates:
note: path: /usr/local/lib/rustc/x86_64-apple-darwin/lib/libcore-c3ca5d77d81b46c1-0.5.dylib
note: meta: name = "core"
note: meta: vers = "0.5"
note: meta: uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8"
note: meta: url = "https://github.com/mozilla/rust/tree/master/src/libcore"
note: path: /usr/local/lib/rustc/x86_64-apple-darwin/lib/libcore-c3ca5d77d81b46c1-0.6.dylib
note: meta: name = "core"
note: meta: vers = "0.6"
note: meta: uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8"
note: meta: url = "https://github.com/mozilla/rust/tree/master/src/libcore"
error: aborting due to previous error

我正在使用 rustc 0.6。我不确定它应该做什么,所以任何人都可以给我一些见解吗?谢谢!

最佳答案

您似乎安装了两个版本的 libstd,0.5 和 0.6。您应该删除旧的:

/usr/local/lib/rustc/x86_64-apple-darwin/lib/libcore-c3ca5d77d81b46c1-0.5.dylib

或者更具体地说明你想链接哪个库:

extern mod std (vers = "0.6");

关于使用rust "extern mod std;"失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16803900/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com