-----------------------參考文檔-------------------------------------html
https://www.rust-lang.org/tools/installvim
https://doc.rust-lang.org/cargo/reference/source-replacement.htmlcurl
---------------------------------------------------------------------工具
本次安裝是在Ubuntu18.04上面進行的測試
概念:ui
1.安裝url
運行curl命令下載rustup並運行安裝spa
curl https://sh.rustup.rs -sSf | sh
如命令行中的提示,經過該命令會下載rust的編譯器和包的管理器cargo命令行
若是提示說Rust is installed now.Great! 表示rust已經安裝完成了3d
生效環境變量
source $HOME/.cargo/env
2.驗證安裝
運行rustc查看版本號
rustc --version
3.運行hello_world
建立包和項目的文件夾
mkdir rust_projects
cd rust_projects
mkdir hello_world
cd hello_world
vim main.rs
在main.rs中輸入內容並保存
fn main(){ println!("hello_world!"); }
使用rustc編譯rs文件
rustc main.rs
編譯完成以後會生成可執行文件
運行main這個可執行文件
./main
----------------------------------------------------------
問題解決:
1.error:linker 'cc' not found
這個是由於沒有安裝gcc致使,安裝gcc以後再次編譯便可
安裝gcc
sudo apt-get build-dep gcc