windows安装

安装vs2015

在安装rust之前,windows平台上需要先安装 Microsoft C++ build tools,推荐2015版本。不过不安装,后面在编译时,会报错说”link.exe”无法找到。

1. note: the msvc targets depend on the msvc linker but `link.exe` was not found

3. note: please ensure that VS 2013 or VS 2015 was installed with the Visual C++ option

5. error: aborting due to previous error

7. error: Could not compile `ws2_32-sys`

打开下面的网站:

<http://landinghub.visualstudio.com/visual-cpp-build-tools>

选择”Download Visual C++ Build Tools 2015”。

下载之后按照提示一路安装即可。

安装rust

操作系统为windows 10 64位。

下载rustup.init.exe,然后安装,按照指示操作,中间要下载rustc等安装文件。

1. Rust Visual C++ prerequisites

3. If you will be targeting the GNU ABI or otherwise know what you are doing then
4. it is fine to continue installation without the build tools, but otherwise,
5. install the C++ build tools before proceeding.

7. Continue? (Y/n) y

10. Welcome to Rust!

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

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

18. C:\Users\aoxia\.cargo\bin

20. This path will then be added to your PATH environment variable by modifying the
21. HKEY_CURRENT_USER/Environment/PATH registry key.

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

26. Current installation options:

28. default host triple: x86_64-pc-windows-msvc
29. default toolchain: stable
30. modify PATH variable: yes

32. 1) Proceed with installation (default)
33. 2) Customize installation
34. 3) Cancel installation

37. info: updating existing rustup installation

40. Rust is installed now. Great!

42. To get started you need Cargo's bin directory (%USERPROFILE%\.cargo\bin) in
43. your PATH environment variable. Future applications will automatically have the
44. correct environment, but you may need to restart your current shell.

46. Press the Enter key to continue.

配置

将 %USERPROFILE%\.cargo\bin 加入到PATH环境变量中。

验证

执行rustc --version:

1. $> rustc --version
2. rustc 1.22.1 (05e2e1c41 2017-11-22)