Rust errors / Names, paths and imports
Rust compiler error · checked with rustc 1.99.0
Rust error E0469: imported macro not found
What it meansA macro listed for import was not found.
What rustc prints
error[E0469]: imported macro not found
--> main.rs:1:13
|
1 | #[macro_use(drink, be_merry)] // error: imported macro not found
| ^^^^^Real output of rustc 1.99.0 compiling the official example below (2021 edition). Your names and line numbers will differ; the first line is the part to match.
The compiler team's explanation
A macro listed for import was not found.
Erroneous code example:
#[macro_use(drink, be_merry)] // error: imported macro not found
extern crate alloc;
fn main() {
// ...
}
Either the listed macro is not contained in the imported crate, or it is not exported from the given crate.
This could be caused by a typo. Did you misspell the macro's name?
Double-check the names of the macros listed for import, and that the crate in question exports them.
A working version would be:
// In some_crate crate:
#[macro_export]
macro_rules! eat {
...
}
#[macro_export]
macro_rules! drink {
...
}
// In your crate:
#[macro_use(eat, drink)]
extern crate some_crate; //ok!From rustc --explain E0469 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
- E0425cannot find value in this scope
- E0603is private
- E0432unresolved import
- E0005refutable pattern in local binding
- E0464The compiler found multiple library files with the requested crate name
- E0468an `extern crate` loading macros must be at the crate root
- E0519The current crate is indistinguishable from one of its dependencies, in terms of metadata
- E0544multiple stability levels
Up next
Often hit nextE0425: cannot find value in this scopeA related error from the same family.Read it next →Did this answer your question?