| Hello, World の実行 |
$ mkdir -p ~/doc/rust/project/hello_world $ cd ~/doc/rust/project/hello_world $ ... ← エディタで main.rs を作成する $ rustc main.rs $ ./main hello world |
| hello_world/main.rs |
fn main() {
println!("hello world");
}
|
| Cargo のバージョン |
$ cargo --version cargo 1.93.0 (083ac5135 2025-12-15) |
| Cargo でプロジェクトを作成する |
$ cd ~/doc/rust/project
$ cargo new hello_cargo
Creating binary (application) `hello_cargo` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
$ tree hello_cargo
hello_cargo
├── Cargo.toml
└── src
└── main.rs
2 directories, 2 files
$ cd hello_cargo
|
| hello_cargo/Cargo.toml |
[package] name = "hello_cargo" version = "0.1.0" edition = "2024" [dependencies] |
| hello_cargo/src/main.rs |
fn main() {
println!("Hello, world!");
}
|
| コンパイルする |
授業で配布するプリントを参照して下さい。 |
| 実行する |
授業で配布するプリントを参照して下さい。 |
| リリース向けビルド |
授業で配布するプリントを参照して下さい。 |