我正在按照《Rust编程语言》一书中的说明来构建一个猜谜游戏,但是每当我try 在VSCodium(VSCode的开源版本)终端中运行我的代码(通过命令Cargo run
)时,我的代码由于以下错误而拒绝运行:
no targets specified in the manifest
either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
下面是我的Cargo.toml文件:
[package]
name = "GuessingGame"
path = "src/GuessingGame.rs"
version = "0.1.0"
edition = "2021"
authors = ["my name <example@example.com>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
版本: VSCodium:1.73.1 操作系统:Zorin OS 16.2
我try 将[package]
更改为[[bin]]
和[lib]
,但出现了更多错误,包括:
this virtual manifest specifies a [lib] section, which is not allowed
和
this virtual manifest specifies a [[bin]] section, which is not allowed