Rust can’t find crate

To add to the given answers, a library compiled as a cdylib (docs) can generate this error when you try to reference it in another project. I solved it by separating the code I wished to reuse in a regular lib project.

Error installing a crate via cargo: specified package has no binaries

cargo install is used to install binary packages that happen to be distributed through crates.io. If you want to use a crate as a dependency, add it to your Cargo.toml. Read the Rust getting started guide and the Cargo getting started guide for further information. In short: cargo new my_project cd my_project echo ‘curl = … Read more

How to use a local unpublished crate?

Add a dependency section to your executable’s Cargo.toml and specify the path: [dependencies.my_lib] path = “../my_lib” or the equivalent alternate TOML: [dependencies] my_lib = { path = “../my_lib” } Check out the Cargo docs for specifying dependencies for more detail, like how to use a git repository instead of a local path.