rust - 错误 : failed to parse manifest caused by: no `package` section found

标签 rust rust-cargo

我已经按照安装部分中的说明从 Microsoft 安装了 C++ 2015 Tools

我收到这个错误:

C:\Users\Mg Sein\Desktop\rust\hello_world>cargo build
error: failed to parse manifest at `C:\Users\Mg Sein\Desktop\rust\Cargo.toml`

Caused by:
  no `package` section found.

这是项目文件的目录:

directory of project file

我为 cargo 添加了路径变量:

add path variable for cargo

这是 Cargo.toml 的内容:

[package]
name = "hello_world"
version = "0.1.0"
authors = ["Mg Sein"]
[dependencies]

最佳答案

我直接在 Rust 项目文件夹中从 cargo.toml 更改为 Cargo.toml 并将 hello.rs 更改为 main .rs 直接在 Rust 项目文件夹中。

由此,

before renaming file

为此,

after renaming file

关于rust - 错误 : failed to parse manifest caused by: no `package` section found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47486841/

相关文章:

rust - 当 native 库不存在时,如何构建 FFI crate 的 docs.rs 文档?

rust - 无法释放文件。收到错误 : could not compile 'libc'

types - HashMap 宏拒绝类型检查,失败并出现误导性(并且看似有缺陷)的错误消息?

c++ - 标准库中是否有与 Rust 的 `std::mem::drop` 等效的 C++?

rust - 链接到二进制箱子

rust - cargo 、工作空间和临时本地依赖项

build - 使用 Cargo 进行源代码构建(外部构建目录)?

rust - Rust 枚举中的原始类型

rust - 循环中的变量生存时间不够长

import - 如何使用 Cargo/Rust 在模块中包含同一目录中的文件?