I'm trying to use another binary project in my project. This is my file structure:
. my_project
├── Cargo.toml
└── src
└── main.rs
└── other_project.rs
. other_project
├── Cargo.toml
└── src
└── main.rs
└── file1.rs
└── file2.rs
The use statements in other_project are giving me an error. other_project/src/file1.rs has "use crate::file2::Struct1" and the complier says "could not find file2 in crate root". I've tried changing the use statements to "use crate::other_project::file2::Struct1" but the error remains.
Following Ch.7 of the book I added:
- other_project = { path = "./other_project"} to my_project/Cargo.toml.
- “pub mod other_project;” to my_project/src/other_project.rs.
- “pub mod other_project” to my_project/src/main.rs