【发布时间】:2020-04-10 06:19:19
【问题描述】:
我正在尝试使用 cargo build 进行构建。以下是项目结构
tree
.
├── Cargo.toml
└── src
└── main.rs
Cargo.toml 的内容
[package]
name = "server"
version = "0.1.0"
authors = ["Lokanath Mohanty <lokanath.mohanty@adcolony.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
src/main.rs的内容
use std::io::{ErrorKind, Read, Write};
use std::net::TcpListener;
use std::sync::mpsc;
use std::thread;
use std::time::Duration;
const LOCAL_IP: &str = "127.0.0.1:6001";
const MSG_SIZE: usize = 32;
fn main() {
...
}
我收到以下错误 -
error: failed to parse manifest at `/home/debashishc/Downloads/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
【问题讨论】:
-
Are you sure ? 提示 "
/home/debashishc/Downloads/Cargo.toml" -
我不明白你的意思。我上传的代码是正确的。
-
- - 给
ls /home/debashishc/Downloads/src/main.rs的命令是什么? -
该文件不存在。但我正在从目录“/home/debashishc/Downloads/Rust/server”运行命令。这个目录确实有一个 Cargo.toml。为什么要在 /home/debashishc/Downloads 中寻找 Cargo.toml ?
标签: rust rust-cargo