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!

相关推荐
鸿乃江边鸟44 分钟前
Spark Datafusion Comet 向量化Rust Native-- 数据写入
大数据·rust·spark·native
m0_748248651 天前
C/C++ 项目与 Rust 项目区别
c语言·c++·rust
Yuer20251 天前
Rust算子库架构设计
rust
rustfs1 天前
RustFS 配置 Cloudflare Tunnel 实现安全访问的详细教程!
分布式·安全·docker·rust·开源
芒鸽2 天前
macos上Rust 命令行工具鸿蒙化适配完全攻略
macos·rust·harmonyos
Smart-Space2 天前
为pngme拓展加密功能与jpg格式支持
rust
古城小栈3 天前
Rust Vec与HashMap全功能解析:定义、使用与进阶技巧
算法·rust
techdashen4 天前
Rust OnceCell 深度解析:延迟初始化的优雅解决方案
开发语言·oracle·rust
superman超哥4 天前
Serde 的零成本抽象设计:深入理解 Rust 序列化框架的哲学
开发语言·rust·开发工具·编程语言·rust序列化
星辰徐哥4 天前
Rust函数与流程控制——构建逻辑清晰的系统级程序
开发语言·后端·rust