clap derive macro Error Example
Putting this one here for anyone searching for the error message:
error: cannot find derive macro `Parser` in this scope
--> src/main.rs:10:17
|
10 | #[derive(Debug, Parser)]
| ^^^^^^
|
note: `Parser` is imported here, but it is only a trait, without a derive macro
--> src/main.rs:4:5
|
4 | use clap::Parser;
| ^^^^^^^^^^^^
error: cannot find attribute `clap` in this scope
--> src/main.rs:13:7
|
13 | #[clap(short, long)]
| ^^^^
|
= note: `clap` is in scope, but it is a crate, not an attribute
The solution for me with this message was to update
my `Cargo.toml`` file from:
Code
clap = 4.3.10"
To:
Code
clap = { version = "4.3.10", features = ["derive"] }