1023 B
1023 B
title, date, tags
| title | date | tags |
|---|---|---|
| Rust | 2023-09-15 09:25:54 |
Rust教程
第一个Rust程序
Rust语言代码文件后缀名为.rs,如helloworld.rs。
fn main() {
println!("Hello World!");
}
使用rustc命令编译helloworld.rs文件:
rustc helloworld.rs # 编译 helloworld.rs 文件
编译后会生成helloworld可执行文件:
./helloworld # 执行 helloworld
Hello World!
Rust环境搭建
安装Rust编译工具
Rust 编译工具从链接 安装 Rust - Rust 程序设计语言 (rust-lang.org) 中下载的Rustup安装。下载好的Rustup在Windows 上是一个可执行程序 rustup-init.exe。(在其他平台上应该是rustup-init.sh)。
现在执行 rustup-init 文件:

