Anupam Minz
Anupam Minz

Reputation: 125

No external crate clap - clap-v3 rust error

The error

error[E0432]: unresolved import `clap`
 --> src/main.rs:1:5
  |
1 | use clap;
  |     ^^^^ no external crate `clap`

The code I an using

use clap;
use regex;

Cargo.toml

[dependencies]
clap-v3 = "3.0.0-beta.1"
regex = "1.4.5"

I have tried using

extern crate clap; 

error[E0463]: can't find crate for `clap`
 --> src/main.rs:1:1
  |
1 | extern crate clap;
  | ^^^^^^^^^^^^^^^^^^ can't find crate

Is there something I am missing ?

Upvotes: 0

Views: 2406

Answers (1)

jonasbb
jonasbb

Reputation: 2583

In the dependencies section you are specifying clap-v3 as a dependency which you need to use like use clap_v3; in your code. Maybe you wanted to add clap (without -v3) as a dependency. It has a release with the same version number.

Upvotes: 3

Related Questions