I am a newbie, trying to learn Rust.
I thought that I created a simple example:
main.rs contains this:
fn main() {
println!("Hello, world!");
}
My cargo.toml looks like this:
[workspace]
members = [ "integration_tests","main", "process"]
resolver = "2"
c2rust-ast-exporter = "0.18.0"
When I try to compile it (using RustRover) I get this message:
Execution failed (exit code 101).
C:/Users/murra/.cargo/bin/cargo.exe +stable-x86_64-pc-windows-msvc vendor --respect-source-config C:\Users\murra\AppData\Local\JetBrains\RustRover2024.1\intellij-rust\stdlib\1.79.0-78065e3802b4d6cbd4b1b22848041e6bb77bc63b\vendor
stdout : error: failed to parse manifest at C:\Users\murra\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
stderr :
What am i missing, I assume it's something obvious but I'm not seeing it!!
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
resolver = "2"
[dependencies]
c2rust-ast-exporter = "0.18.0"
That with a src/main.rs file should give you a basic package setup that compiles when you run Cargo. You read more about the manifest file (Cargo.toml) here. These chapters of the Cargo Book might also be of special interest for you:
Hi jofas:
I tried your suggestions but am now getting this message:
error: failed to parse manifest at C:\Users\murra\Cargo.toml
Is my corgo.toml file somehow corrupt??
Could you please post the content of your Cargo.toml file? There might still be some weirdness going on with the workspace settings. The path C:\Users\murra\Cargo.toml looks fishy to me. You usually don't want to develop a Cargo package or workspace in your home directory, but keep it in a self-contained folder to avoid any interference or to mess up the lookup-path of Cargo. If there is a Cargo.toml at this path that is corrupt and you have a Cargo project in a subdirectory, building said project will fail, as Cargo traverses the whole path to find any manifests further up in the file tree to see if your package is part of a workspace.
Normally the file structure of a basic cargo package created with cargo new looks like this:
.
├── Cargo.toml
└── src
└── main.rs
When you run cargo build or cargo run (or any other build command) from the directory where the Cargo.toml file is, everything should work fine.
Hi jofas:
You were correct, there WAS a cargo.toml file in ' C:\Users\murra\Cargo.toml), I deleted it.
when I "Run -> Start debugging I get this message:
Select Debugger, with choices of
LLDB
C++ (GDB/LLDB)
C++ (Windows)
Install an extension for Rust
I am unsure which choice I should make here.
BTW my environment is Windows 11 Porfessional 64-bit