Installing Rust

1.官方说明

If you're on Linux or a Mac, all you need to do is this (note that you don't need to type in the $s, they just indicate the start of each command):

  curl -s https://static.rust-lang.org/rustup.sh | sudo sh

2.我的环境:

  Centos 7.0 64位

  ①执行命令:curl -s https://static.rust-lang.org/rustup.sh | sudo sh

 

  ②安装完毕,提示 :

  

     LD_LIBRARY_PATH:Linux环境变量名,该环境变量主要用于指定查找共享库(动态链接库)时除了默认路径之外的其他路径。(该路径在默认路径之前查找)

  移植程序时的经常碰到需要使用一些特定的动态库,而这些编译好的动态库放在我们自己建立的目录里,这时可以将这些目录设置到LD_LIBRARY_PATH中。

    当执行函数动态链接.so时,如果此文件不在缺省目录下‘/lib’ and ‘/usr/lib’.

  那么就需要指定环境变量LD_LIBRARY_PATH

  ③If you've got Rust installed, you can open up a shell, and type this:

   rustc --version

  报error啦

  ④解决方案:配置LD_LIBRARY_PATH

    a.vim /etc/ld.so.conf

    b.添加一行代码

     /usr/local/lib

    c.以root身份登录执行命令

     ldconfig -v

  ⑤再查看版本

  rustc --version

  

  OK,到此rust安装成功。

3.编写第一个rust程序并编译执行

  a.vim test.rs 

// test.rs
fn main() {
    println!("Hello, world!");
}

   b. ls 查看文件

     

  c. 编译

  执行命令:rustc test.rs

    

  生成一个二进制文件test

  d.执行可执行文件test

    执行命令:./test

  e.运行结果

    

 

 

 

 
posted @ 2015-01-07 23:05  yangss001  阅读(375)  评论(0编辑  收藏  举报