始めに
あまりにしょうもないので、書く必要はあまりないですが...
コマンドを眺めてなんとなく察してください。
ちなみにIronはあまり関係ないです。
コンソール
$ cargo new iron # ironと言う名のプロジェクトを新規作成
$ cd iron/
# Cargo.tomlを記述
# main.rsを記述
$ cargo build
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading iron v0.6.0
.
.
.
Compiling iron v0.6.0
Compiling iron v0.1.0 (file:///home/owner1/iron)
error[E0465]: multiple rlib candidates for `iron` found
--> src/main.rs:1:1
|
1 | extern crate iron;
| ^^^^^^^^^^^^^^^^^^
|
note: candidate #1: /home/owner1/iron/target/debug/deps/libiron-963e08b973c03147.rlib
--> src/main.rs:1:1
|
1 | extern crate iron;
| ^^^^^^^^^^^^^^^^^^
note: candidate #2: /home/owner1/iron/target/debug/deps/libiron-0522d99389c4e8dc.rlib
--> src/main.rs:1:1
|
1 | extern crate iron;
| ^^^^^^^^^^^^^^^^^^
error[E0463]: can't find crate for `iron`
--> src/main.rs:1:1
|
1 | extern crate iron;
| ^^^^^^^^^^^^^^^^^^ can't find crate
error: aborting due to 2 previous errors
error: Could not compile `iron`.
To learn more, run the command again with --verbose.
この解決に1時間くらい頭を抱えていました。
原因と解決策
原因
$ cargo new iron
プロジェクト名にモジュール名と同じものを入れていたのが問題でした。
解決策を次に示します。
というかプロジェクト名を変えるだけです。
Cargo.toml
[package]
name = "iron_sample"
終わりに
プロジェクト名は被らないようにしよう!
もし何か気づいたこと、気になったことがあれば教えていただけると幸いです。