Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 288
Tyler Avatar asked Mar 22 '15 00:03

Tyler


1 Answers

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.

like image 85
Steve Klabnik Avatar answered Oct 04 '22 03:10

Steve Klabnik