Clap macro not found

Hello I am trying to use claps' macros but upon compile says they are not found.

main.rs:

#[macro_use]
use clap::{App}; //v2.33.0


fn main() {
    let matches = App::new("Parse Rain Gage")
        .version(crate_version!())
        .author(crate_author!())
        .about(crate_description!());

    println!("fooo barr!");
}

and cargo output:

b:\my_rust\test1>cargo build
   Compiling test1 v0.1.0 (B:\my_rust\test1)

error: cannot find macro `crate_version!` in this scope
 --> src\main.rs:7:18
  |
7 |         .version(crate_version!())
  |                  ^^^^^^^^^^^^^


error: aborting due to 3 previous errors

error: Could not compile `test1`.

You should not add #[macro_use] on use statements. Either

#[macro_use]
extern crate clap;

or

use clap::{crate_version, crate_authors, crate_description};

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.