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!

相关推荐
web前端进阶者6 小时前
Rust初学知识点快速记忆
开发语言·后端·rust
一只幸运猫.10 小时前
Rust实用工具特型-Clone
开发语言·后端·rust
咚为10 小时前
深入浅出 Rust 内存顺序:从 CPU 重排到 Atomic Ordering
开发语言·后端·rust
咚为12 小时前
深入浅出 Rust RefCell:打破静态检查的“紧箍咒”
开发语言·后端·rust
lUie INGA1 天前
rust web框架actix和axum比较
前端·人工智能·rust
沛沛rh451 天前
深入并发编程:从 C++ 到 Rust 的学习笔记
c++·笔记·学习·算法·rust
沛沛rh451 天前
力扣 42. 接雨水 - 高效双指针解法(Rust实现)详细题解
算法·leetcode·rust
pan3035074791 天前
在 Vue 3 + Vite 项目中覆盖 Element Plus 的默认样式
前端·vue.js·rust
Rust研习社1 天前
Rust 的构建脚本是什么?今天一次性搞懂它
rust
向上的车轮2 天前
从零实现一个高性能 HTTP 服务器:深入理解 Tokio 异步运行时与 Pin 机制
rust·系统编程·pin·异步编程·tokio·http服务器