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!

相关推荐
csdn_life1819 小时前
Rustrover 如何像Java一样直接 进行调试和运行
java·开发语言·rust
Source.Liu1 天前
【time-rs】Date 结构体详解
rust·time
qq_256247052 天前
Rust 模块化单体架构:告别全局 Migrations,实现真正的模块自治
开发语言·架构·rust
分布式存储与RustFS2 天前
MinIO替代方案与团队适配性分析:RustFS如何匹配不同规模团队?
人工智能·rust·开源项目·对象存储·minio·企业存储·rustfs
分布式存储与RustFS2 天前
MinIO替代方案生态集成指南:RustFS如何无缝融入现代技术栈
rust·github·开源项目·对象存储·minio·企业存储·rustfs
王燕龙(大卫)2 天前
rust:线程
开发语言·rust
李广坤2 天前
Rust基本使用
后端·rust
Source.Liu2 天前
【time-rs】Duration 结构体详解
rust·time
Chen--Xing2 天前
LeetCode 49.字母异位词分组
c++·python·算法·leetcode·rust
古城小栈2 天前
Go+Rust混合编程:高性能系统开发的最优解之一
golang·rust