2013-05-29 44 views
2

我開始「爲Ruby開發者鏽」的教程和這個代碼已經絆倒了我,讓鐵鏽「extern mod std;」失敗

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。我不確定它應該做什麼,所以任何人都可以給我一些見解?謝謝!

+0

你嘗試去'在/ usr/local/lib目錄/ rustc/x86_64-apple-darwin/lib/libcore-c3ca5d77d81b46c1-0.5.dylib',並刪除它(或只是重命名它)? –

+0

@RamonSnir是正確的,你應該刪除該目錄中的所有'...- 0.5.dylib'文件。 – huon

回答

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");