win10 idea 集成 rust
1 下载 rustup-init.exe
https://www.rust-lang.org/zh-CN/tools/install
2 安装
上图显示 安装向导。
如果你已经安装 MSVC (推荐),那么安装过程会非常的简单,输入 1 并回车,直接进入第二步。
如果你安装的是 MinGW,那么你需要输入 2 (自定义安装),然后系统会询问你 Default host triple? ,请将上图中 default host triple 的 "msvc" 改为 "gnu" 再输入安装程序:
设置完所有选项,会回到安装向导界面(第一张图),这是我们输入 1 并回车即可。
这一步就完成了 Rust 的安装,可以通过以下命令测试: rustc -V # 注意的大写的 V
3 idea 安装 rust 插件
4 配置
5 下载源码
在 cmd 里直接输入 即下载完成(idea 会自动找到路径)
rustup component add rust-src
6 即可创建 rust 项目
7 运行 main.rs
error: linker `link.exe` not found
|
= note: 系统找不到指定的文件。 (os error 2)
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed with the Visual C++ option
报上面的错,则需要
安装 VISUAL STUDIO 2017 ( https://www.visualstudio.com/downloads/ )
或者 安装C++ build tools
Microsoft Visual C++ Build Tools 2015 (http://go.microsoft.com/fwlink/?LinkId=691126 下载地址)
二选一
8 安装后在运行
恭喜成功