Windows 安装Rust

1. 安装前环境准备 Rust只有编译器没有链接器,还需要CC的链接器。Windows上CC的编译链有微软提供的Visual Studio的 MSVC和GNU的MinGW 为什么Windows下安装Rust需要C

1. 安装前环境准备

Rust只有编译器没有链接器,还需要C/C++的链接器。Windows上C/C++的编译链有微软提供的Visual Studio的 MSVC和GNU的MinGW
为什么Windows下安装Rust需要C/C++的链接器,应该是需要支持FFI 的原因
由于我的电脑已经安装VS2017,所以无需再安装

没有链接器环境的下载访问:Microsoft C++ 生成工具 - Visual Studio

下载安装

 

2. 安装

2.1 下载

下载首页:https://www.rust-lang/zh-CN/tools/install
下载路径:https://static.rust-lang/rustup/dist/i686-pc-windows-msvc/rustup-init.exe
当然,我这里选择下载的是32位的安装程序

2.2 安装

双击运行下载的exe,如下界面

 

 2.3 安装完成

 

3.验证

以管理员身份重新打开命令行

输入命令

rustc --version

 

4.Hello World

4.1 新建项目

新建个文件夹,命名为hello_world,然后新建 hello_world.txt文件,在hello_world.txt 里编写代码,保存,最后更改文件扩展名.txt 为 .rs

 

4.2 编译hello_world

在hello_world 文件夹所在路径打开powershell窗口(在hello_world 文件夹空白处 按住Shift 键,然后右键 选择 在此处打开Powershell 窗口)
输入编译命令

rustc .\hello_world.rs

 4.3 运行hello_world

输入命令

 .\hello_world.exe

 

发布者:admin,转转请注明出处:http://www.yc00.com/web/1737772757a3977962.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信