Rust入门-Hello World

1、安装

LinuxmacOS 上安装 rustup

打开终端并输入下面命令:

$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

如果安装成功,将出现下面这行:

Rust is installed now. Great!

2、更新

$ rustup self uninstall

3、卸载

$ rustup self uninstall

4、检查安装是否成功

$ rustc -V
rustc 1.56.1 (59eed8a2a 2021-11-01)

$ cargo -V
cargo 1.57.0 (b2e52d7ca 2021-10-21)

5、创建和运行第一个程序 Hello World

(1)创建一个新项目,cargo是Rust的包管理工具

$ cargo new world_hello
$ cd world_hello

(2)运行项目

(base) guilinhuang@GuilindeMacBook-Pro world_hello % cargo run         
   Compiling world_hello v0.1.0 (/Users/guilinhuang/Desktop/RustProject/world_hello)
    Finished dev [unoptimized + debuginfo] target(s) in 0.83s
     Running `target/debug/world_hello`
Hello, world!

看到Hello world!就大功告成啦

千里之行,始于足下,加油!

在这里插入图片描述

  • 24
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值