Skip to content

Building from source missing clap derive macro #19

@mwly

Description

@mwly

When Cloning this Repo and building from source i got
Parser is imported here, but it is only a trait, without a derive macro

Adding the solution from this stackoverflow thread helped
https://stackoverflow.com/a/69898700

I didn't open a PR because you might very well have a reason not to enable the flag.

full Error:

error: cannot find derive macro `Parser` in this scope
  --> src/bin/aascheck.rs:17:10
   |
17 | #[derive(Parser)]
   |          ^^^^^^
   |
note: `Parser` is imported here, but it is only a trait, without a derive macro
  --> src/bin/aascheck.rs:10:5
   |
10 | use clap::Parser;
   |     ^^^^^^^^^^^^

error: cannot find attribute `clap` in this scope
  --> src/bin/aascheck.rs:18:3
   |
18 | #[clap(
   |   ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
  --> src/bin/aascheck.rs:23:7
   |
23 |     #[clap(parse(from_os_str))]
   |       ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
  --> src/bin/aascheck.rs:25:7
   |
25 |     #[clap(short, long)]
   |       ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error[E0599]: no function or associated item named `parse` found for struct `Opts` in the current scope
  --> src/bin/aascheck.rs:55:21
   |
22 | struct Opts {
   | ----------- function or associated item `parse` not found for this struct
...
55 |     let opt = Opts::parse();
   |                     ^^^^^ function or associated item not found in `Opts`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following traits define an item `parse`, perhaps you need to implement one of them:
           candidate #1: `Parser`
           candidate #2: `TypedValueParser`
           candidate #3: `object::read::coff::file::CoffHeader`
           candidate #4: `object::read::elf::file::FileHeader`
           candidate #5: `object::read::macho::file::MachHeader`
           candidate #6: `object::read::pe::file::ImageNtHeaders`
           candidate #7: `time::parsing::parsable::sealed::Sealed`
           candidate #8: `nom::internal::Parser`
           candidate #9: `nom::sequence::Tuple`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `basyx-rs` (bin "aascheck") due to 5 previous errors
error: failed to compile `basyx-rs v0.2.1 (~/SRC/Basyx/basyx-rust-sdk)`, intermediate artifacts can be found at `~/SRC/Basyx/basyx-rust-sdk/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions