Cannot find box for `num`

I'm trying to use BigUints from a num box in Rust, and I use this code to import them:

extern crate num; use num::bigint::BigUint; 

However, when compiling, it returns the following error:

 main.rs:1:1: 1:18 error: can't find crate for `num` main.rs:1 extern crate num; ^~~~~~~~~~~~~~~~~ error: aborting due to previous error 

I do not use any compiler flags.

What am I doing wrong?

+7
import rust rust-crates
source share
1 answer

I do not use any compiler flags.

If you use only rustc , you will need to use flags to capture num crate

 $ rustc foo.rs --extern num=/path/to/num.rlib 

should do it, I think. Of course, you will need to get a copy of the num box: https://crates.io/crates/num links to https://github.com/rust-lang/num .

If you use Cargo, you can simply add

 num = "*" 

In the section [dependencies] Cargo.toml , and you will be well off.

+11
source share

All Articles