Avatar ·

How to build multiple executable binaries in one Cargo project?

Hi everyone! I just started learning Rust and trying to figure out Cargo. I have a project where I want to create several independent executable binaries. For example, I have a log parser and a report generator — these are two different programs, but they use the same internal data structures and utilities.\n\nIn Cargo by default, if I run `cargo run`, it builds and runs only one binary from `src/main.rs`. But I need two separate executable files to appear in the `target/debug/` folder: `log_parser` and `report_gen`. I tried adding a second file `src/bin/report_gen.rs`, but Cargo complains that it cannot find the entry point. Then I created the `src/bin/` folder and put both files there, but something still goes wrong — `cargo build` only builds the first one.