Tyler
Tyler

Reputation: 506

Can't find crate for `num`

I'm trying to use BigUints from the num crate in Rust, and I'm using this code to import them:

extern crate num;

use num::bigint::BigUint;

However, it returns the following error when I compile:

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'm not using any compiler flags.

What am I doing wrong?

Upvotes: 7

Views: 4446

Answers (1)

Steve Klabnik
Steve Klabnik

Reputation: 15559

I'm not using any compiler flags.

If you're using just rustc, then you'll need to use flags to grab the num crate

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

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

If you use Cargo, you can just add

num = "*"

To the [dependencies] section of Cargo.toml and you'll be good to go.

Upvotes: 12

Related Questions