error: linker `link.exe` not found

开始学习rust,安装好rust的环境,开始从hello world开始,结果用在win10环境下,使用vs code或cmd窗口编译rust报错:

rust 复制代码
PS E:\study_codes\rust-demo\chart01> rustc hello.rs
error: linker `link.exe` not found
  |
  = note: program not found

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

note: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option.

note: VS Code is a different product, and is not sufficient.

error: aborting due to 1 previous error

vs code或cmd窗口中运行以下命令即可解决:

bash 复制代码
rustup uninstall toolchain stable-x86_64-pc-windows-msvc
rustup toolchain install stable-x86_64-pc-windows-gnu
rustup default stable-x86_64-pc-windows-gnu

运行rust编译命令:

rust 复制代码
rustc hello.rs
.\hello.exe

生成一个hello.exe文件

运行结果:

hello world

Have fun learning about rust!

相关推荐
独好紫罗兰1 天前
通过例子学 rust 个人精简版 5-all
rust
heroboyluck1 天前
rust 实例化动态对象
开发语言·rust·trait
Source.Liu1 天前
【CXX】4 跨平台构建系统特性对比
c++·rust·cxx
Hello.Reader1 天前
深入探讨 Rust 中的 Deref Trait:让智能指针像常规引用一样工作
开发语言·后端·rust
yoona10201 天前
Rust编程语言入门教程 (七)函数与控制流
开发语言·rust·区块链·学习方法
JD技术委员会1 天前
Rust 未来会成为主流的编程语言吗?
开发语言·后端·rust
无名之逆1 天前
探索 Hyperlane:高性能 Rust Web 框架的崛起
java·开发语言·后端·python·算法·面试·rust
懒羊羊我小弟2 天前
Webpack 基础入门
前端·webpack·rust·node.js·es6
武侠编程3 天前
Rust兵器谱|流星镖:tokio
rust
大雄野比3 天前
rust学习三、基本类型
开发语言·学习·rust