Hi all,
I am trying to create a lib crate in cargo's examples directory so that I can use it in another crate in the examples directory. I have read Cargo's documentation on this but I am still unable to get it to work.
I am getting the following error:
$ cargo +nightly build --examples
Compiling example_crate v0.1.0 (.../example_crate)
error[E0432]: unresolved import `b`
--> examples/c.rs:1:5
|tr
1 | use b::b;
| ^ Could not find `b` in `{{root}}`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0432`.
error: Could not compile `example_crate`.
To learn more, run the command again with --verbose.
When I look at the target
directory I do see that the lib is created but it is not included in the deps directory:
$ tree target/debug/examples/
target/debug/examples/
├ b-1dcc503f23e0b76b.d
├ b-7b617d848b897e49.d
├ b-e7c00f0c42ff9607.d
├ c-4cad30ab9241529b.d
├ c-ecabb81ac2bff21c.d
├ libb-1dcc503f23e0b76b.rmeta
├ libb-7b617d848b897e49.rlib
├ libb.d
├ libb-e7c00f0c42ff9607.rmeta
├ libb.rlib
└ libb.rmeta
0 directories, 11 files
tree target/debug/deps/
target/debug/deps/
├── example_crate-08f3e93bc1a6d201.d
├── example_crate-1a178177b8db9299.d
├── example_crate-377ea239c50fee8d.d
├── example_crate-472d54d512ae0a93.d
├── example_crate-b9a91e87870b8d8f
├── example_crate-b9a91e87870b8d8f.d
├── libexample_crate-08f3e93bc1a6d201.rlib
├── libexample_crate-1a178177b8db9299.rmeta
├── libexample_crate-377ea239c50fee8d.rmeta
└── libexample_crate-472d54d512ae0a93.rmeta
I have uploaded a git repo with all of the details here. Any help is greatly appreciated.
Thanks!