Back

rust - 1.入门. (安装 , cargo )

发布时间: 2019-08-17 06:45:00

官方网站:https://www.rust-lang.org/

参考 https://doc.rust-lang.org/book/ch01-02-hello-world.html

1. 安装 curl https://sh.rustup.rs -sSf | sh

This will download and install the official compiler for the Rust programming 
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin 
directory, located at:

  /home/siwei/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile file located at:

  /home/siwei/.profile

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable
  modify PATH variable: yes

1) Proceed with installation (default)

2.  把这句话 :  source ~/.cargo/env     添加到 ~/.bashrc中

3. 新建文件 main.rs

fn main(){
    println!("hihihi");
}

4. 编译

rustc main.rs

./main

就可以看到  hihihi  被打印出来了。

Back