Reputation: 25691
I am trying to create a rust workspace, having multiple binaries to build from same project
Actually I prepared structure as follow
Where external Cargo.tml contains only
[workspace]
members = ["itris-console", "autolearn" ]
And itris-console/Cargo.toml contains
[package]
name = "itris"
version = "0.1.0"
edition = "2021"
[dependencies]
rand = "0.8.5"
arr_macro = "0.1.3"
[[bin]]
name = "itris"
path = "src/main.rs"
test = false
bench = false
And autolearn/Cargo.toml is
[package]
name = "autolearn"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
I am trying to build it all from project root (the itris2 directory)
I got this problem
cargo build
error: failed to load manifest for workspace member `C:\Progetti\rust\itris2\itris-console`
Caused by:
failed to read `C:\Progetti\rust\itris2\itris-console\Cargo.toml`
Caused by:
Impossibile trovare il percorso specificato. (os error 3)
I consulted what follows but I cannot make it works
Upvotes: 1
Views: 788
Reputation: 628
The itris-console and autolearn directories should not be in a src directory.
Currently path to your itris-console directory is C:\Progetti\rust\itris2\src\itris-console
while it should be C:\Progetti\rust\itris2\itris-console
. Remove the unnecessary src
directory from the path and you are almost good to go.
Since you are on windows you also need to use escaped forward-slashes while defining the path to the bin in itris-console\Cargo.toml
("src/main.rs"
-> "src\\main.rs"
).
Upvotes: 2