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!

相关推荐
techdashen14 分钟前
Rust主流框架性能比拼: Actix vs Axum vs Rocket
开发语言·后端·rust
Source.Liu2 小时前
【Raqote】 1.2 路径填充ShaderClipMaskBlitter结构体(blitter.rs)
rust·cad
pumpkin845143 小时前
理解 Rust 中的 String 分配机制
开发语言·rust
维维酱6 小时前
Rust - Deref 强制转换
rust
XuanXu8 小时前
我使用Tauri deep-link插件踩过的坑
rust
无名之逆10 小时前
[特殊字符] 超轻高性能的 Rust HTTP 服务器 —— Hyperlane [特殊字符][特殊字符]
java·服务器·开发语言·前端·网络·http·rust
不爱学英文的码字机器12 小时前
Rust 的征服:从系统编程到全栈开发的 IT 新宠
开发语言·后端·rust
维维酱13 小时前
Rust 智能指针
rust
无名之逆1 天前
[特殊字符] Hyperlane:Rust 高性能 HTTP 服务器库,开启 Web 服务新纪元!
java·服务器·开发语言·前端·网络·http·rust
无名之逆1 天前
Hyperlane框架:下一代高性能Rust Web框架 [特殊字符]
服务器·开发语言·前端·后端·http·rust