Rust errors / Names, paths and imports
Rust compiler error · checked with rustc 1.99.0
Rust error E0459: `#[link]` attribute requires a `name = "string"` argument
What it meansA link was used without a name parameter.
What rustc prints
error[E0459]: `#[link]` attribute requires a `name = "string"` argument
--> main.rs:1:1
|
1 | #[link(kind = "dylib")] extern "C" {}
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argumentReal 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 link was used without a name parameter.
Erroneous code example:
#[link(kind = "dylib")] extern "C" {}
// error: `#[link(...)]` specified without `name = "foo"`
Please add the name parameter to allow the rust compiler to find the library you want. Example:
#[link(kind = "dylib", name = "some_lib")] extern "C" {} // ok!From rustc --explain E0459 (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
- E0453allow(non_snake_case) incompatible with previous forbid
- E0454link name must not be empty
- E0460Found possibly newer version of crate `..` which `..` depends on
- E0461Couldn't find crate `..` with expected target triple `..`
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?