]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0462.md
Rollup merge of #107190 - fmease:fix-81698, r=compiler-errors
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0462.md
1 Found `staticlib` `..` instead of `rlib` or `dylib`.
2
3 Consider the following two files:
4
5 `a.rs`
6 ```ignore (cannot-link-with-other-tests)
7 #![crate_type = "staticlib"]
8
9 fn foo() {}
10 ```
11
12 `main.rs`
13 ```ignore (cannot-link-with-other-tests)
14 extern crate a;
15
16 fn main() {
17     a::foo();
18 }
19 ```
20
21 Crate `a` is compiled as a `staticlib`. A `staticlib` is a system-dependant
22 library only intended for linking with non-Rust applications (C programs). Note
23 that `staticlib`s include all upstream dependencies (`core`, `std`, other user
24 dependencies, etc) which makes them significantly larger than `dylib`s:
25 prefer `staticlib` for linking with C programs. Learn more about different
26 `crate_type`s in [this section of the Reference](../reference/linkage.html).
27
28 This error can be fixed by:
29  * Using [Cargo](../cargo/index.html), the Rust package manager, automatically
30    fixing this issue.
31  * Recompiling the crate as a `rlib` or `dylib`; formats suitable for Rust
32    linking.