0

I am trying to create a rust workspace, having multiple binaries to build from same project

Actually I prepared structure as follow

enter image description here

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

realtebo
  • 23,922
  • 37
  • 112
  • 189

1 Answers1

1

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").

Challe
  • 599
  • 4
  • 19