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!

相关推荐
西门吹-禅3 小时前
【Rust setup】
rust·rust setup
x-cmd9 小时前
agent-browser 源码分析(一):架构概览
rust·架构设计·浏览器自动化·cdp·agent-browser
Hemy0811 小时前
tauri + rust 创建初始项目
开发语言·后端·rust
古城小栈11 小时前
Rust 三方库 anyhow:极简错误处理实战指南
java·网络·rust
@atweiwei11 小时前
LangChainRust Agent 引擎:Graph 构建到执行
rust·langchain·llm·agent·rag·langchaingraph
techdashen1 天前
Pingora 的开源——Cloudflare 基于 Rust 搭建的用于替换Nginx的网络框架
nginx·rust·开源
余识-1 天前
古竹:将时间化作最有价值的投资
金融·rust·业界资讯·tauri·投资·基金
skilllite作者1 天前
Deer-Flow 工作流引擎深度评测报告
java·大数据·开发语言·chrome·分布式·架构·rust
alwaysrun1 天前
Rust之数据固定Pin与Unpin
rust·编程语言