Rust初体验

下载

https://forge.rust-lang.org/infra/archive-stable-version-installers.html
Windows: x86_64-pc-windows-gnu

windows配置path

RUST_HOME=D:\your_dir\rust-1.80.1

PATH添加:

%RUST_HOME%\rustc\bin
%RUST_HOME%\cargo\bin

Linux系统下按Linux设置对应的path

验证

rust编译器 rustc:

rustc --version
cargo --version

Hello world

创建一个文本文件 hello.rs,代码如下:

fn main() {
    println!("Hello World!");
}

编译:

rustc hello.rs

同目录下生成两个文件:hello.exe, hello.pdb
再运行hello.exe,即可看到打印

Hello World!

表示首个rust编写并运行成功。

IDE

  • RustRover或安装Vscode插件
    建议RustRover
posted @   漠孤烟  阅读(11)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
点击右上角即可分享
微信分享提示