Rust:Cargo.toml错误:在尝试包含nalgebra时,找到了预期项“[`”
我试图用上述Cargo.toml编译rust,但它给了我以下错误:Rust:Cargo.toml错误:在尝试包含nalgebra时,找到了预期项“[`”,rust,rust-cargo,Rust,Rust Cargo,我试图用上述Cargo.toml编译rust,但它给了我以下错误: [package] name = "my package" version = "0.1.0" authors = ["me"] edition = "2018" [dependencies] nalgebra = "0.18.1" 如果我删除nalgebra=“0.18.1”,我可以解决这个问题,但我不能使用nalgebra包,所以它对我没有帮助。我认为您的货物有多个问题。toml 这是不允许的: error: expec
[package]
name = "my package"
version = "0.1.0"
authors = ["me"]
edition = "2018"
[dependencies]
nalgebra = "0.18.1"
如果我删除
nalgebra=“0.18.1”
,我可以解决这个问题,但我不能使用nalgebra
包,所以它对我没有帮助。我认为您的货物有多个问题。toml
这是不允许的:
error: expected item, found `[`
--> Cargo.toml:1:1
|
1 | [package]
| ^ expected item
error: aborting due to previous error
建议:
name = "my package"
还有缺失的部分:
name = "my-package"
你能把整个文件都贴在这里吗
最低可行设置:
error during execution of `cargo metadata`: error: failed to parse manifest at `test/Cargo.toml`
Caused by:
no targets specified in the manifest
either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
src/main.rs
[package]
name = "my-package"
version = "0.1.0"
authors = ["me"]
edition = "2018"
[[bin]]
name = "radkilla"
path = "src/main.rs"
doc = false
[dependencies]
nalgebra = "0.18.1"
运行fmt和构建:
fn main() {}
关闭visual studio上打开的cargo.toml文件后,错误消失。看起来您(或您的IDE)错误地运行了
rustc-cargo.toml
,而不是cargo-run
或其他任何内容。(找到了预期项目…
是一个rustc错误。)[[bin]]如果您有src/main.rs
文件,则不需要使用部分-Cargo将自动拾取该文件。
➜ test cargo fmt ; cargo build
Finished dev [unoptimized + debuginfo] target(s) in 0.11s