我在和目录中有两个独立创建的libsomelibrary.rlib文件。我的目录中还有一个项目需要静态链接到./path/to/deps/debug//path/to/deps/release//path/to/myproject/libsomelibrary.rlib
如何在 Cargo.toml(或其他地方)中指定对这些 .rlib 的引用?
我尝试在 Cargo.toml 中添加somelibrary以下内容[dependencies]。使用 build.rs 指定搜索路径和文件名:
println!("cargo:rustc-link-lib=static=somelib");
println!("cargo:rustc-link-search=/path/to/deps/debug/");
Run Code Online (Sandbox Code Playgroud)
然后在 Cargo.toml 中:
[package]
build = "build.rs"
links = "somelibrary"
Run Code Online (Sandbox Code Playgroud)
但我仍然遇到链接错误。
rust ×1