Skip to content

Conversation

@hanqitech
Copy link

When I try to compile project 2, I met error messages .
Command
cargo run -- --upstream 171.67.215.200:80
message
error[E0432]: unresolved import clap::Clap--> src/main.rs:4:5 | 4 | use clap::Clap; | ^^^^^^^^^^ noClap` in the root

error: cannot determine resolution for the derive macro Clap
--> src/main.rs:10:10
|
10 | #[derive(Clap, Debug)]
| ^^^^
|
= note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute clap in this scope
--> src/main.rs:11:3
|
11 | #[clap(about = "Fun with load balancing")]
| ^^^^
|
= note: clap is in scope, but it is a crate, not an attribute

error: cannot find attribute clap in this scope
--> src/main.rs:13:7
|
13 | #[clap(
| ^^^^
|
= note: clap is in scope, but it is a crate, not an attribute

error: cannot find attribute clap in this scope
--> src/main.rs:20:7
|
20 | #[clap(short, long, about = "Upstream host to forward requests to")]
| ^^^^
|
= note: clap is in scope, but it is a crate, not an attribute

error: cannot find attribute clap in this scope
--> src/main.rs:22:7
|
22 | #[clap(
| ^^^^
|
= note: clap is in scope, but it is a crate, not an attribute

error: cannot find attribute clap in this scope
--> src/main.rs:28:7
|
28 | #[clap(
| ^^^^
|
= note: clap is in scope, but it is a crate, not an attribute

error: cannot find attribute clap in this scope
--> src/main.rs:34:7
|
34 | #[clap(
| ^^^^
|
= 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 CmdOptions in the current scope
--> src/main.rs:70:31
|
12 | struct CmdOptions {
| ----------------- function or associated item parse not found for this struct
...
70 | let options = CmdOptions::parse();
| ^^^^^ function or associated item not found in CmdOptions
|
= 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

Some errors have detailed explanations: E0432, E0599.
For more information about an error, try rustc --explain E0432.
error: could not compile balancebeam (bin "balancebeam") due to 9 previous errors`

I doubt it's about Crate clap's version ,So I updated it's version and did a little change ,then It compiles .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant