2

我开始了“rubyists 生锈”教程,这段代码让我大吃一惊:

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。我不确定它应该做什么,所以任何人都可以给我一些见解吗?谢谢!

4

1 回答 1

5

您似乎安装了两个版本的 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");
于 2013-05-29T14:16:11.683 回答