I have searched Stackoverflow and the internet far and wide for an answer to my problem but have found no fix yet. I have written a program in rust using the crates 'rand' and 'matrix'. I have added both using cargo, and added the lines
extern crate rand;
extern crate matrix;
use rand::prelude::*;
use matrix::prelude::*;
This error occurs:
error[E0463]: can't find crate for `rand`
--> main.rs:1:1
|
1 | extern crate rand;
| ^^^^^^^^^^^^^^^^^^ can't find crate
error[E0463]: can't find crate for `matrix`
--> main.rs:2:1
|
2 | extern crate matrix;
| ^^^^^^^^^^^^^^^^^^^^ can't find crate
error[E0433]: failed to resolve: use of undeclared type `Compressed`
--> main.rs:45:49
|
45 | let mut m1: matrix::prelude::Compressed<i32> = Compressed::zero((5,5));
| ^^^^^^^^^^ use of undeclared type `Compressed`
error[E0433]: failed to resolve: use of undeclared type `Compressed`
--> main.rs:46:49
|
46 | let mut m2: matrix::prelude::Compressed<i32> = Compressed::zero((5,5));
| ^^^^^^^^^^ use of undeclared type `Compressed`
error[E0433]: failed to resolve: use of undeclared type `Compressed`
--> main.rs:47:49
|
47 | let mut m3: matrix::prelude::Compressed<i32> = Compressed::zero((5,5));
| ^^^^^^^^^^ use of undeclared type `Compressed`
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0433, E0463.
For more information about an error, try `rustc --explain E0433`.
My cargo.toml contains the following:
[package]
name = "mat_mult"
version = "0.1.0"
edition = "2021"
[dependencies]
matrix = "0.22.0"
rand = "0.8.5"
When I do cargo build
the program runs and works fine without errors, these errors only occur when attempting to compile with rustc main.rs
. It is important for me to be able to compile the program because I would like to run it on a remote system on which I am unable to install cargo.
Any indications of something that I am missing?