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!

相关推荐
ftzchina12 小时前
Rust学习总结之-枚举
rust·枚举
祈澈菇凉12 小时前
什么是Sass,如何使用?
前端·rust·sass
SomeB1oody1 天前
【Rust中级教程】2.10. API设计原则之受约束性(constrained) Pt.1:对类型进行修改、`#[non_exhaustive]`注解
开发语言·后端·性能优化·rust
Hello.Reader1 天前
Rust 并发编程:使用消息传递进行线程间数据共享
c++·算法·rust
SomeB1oody1 天前
【Rust中级教程】2.9. API设计原则之显然性(obvious) :文档与类型系统、语义化类型、使用“零大小”类型
开发语言·后端·rust
Vitalia2 天前
从入门到精通Rust:资源库整理
开发语言·后端·rust
m0_663234012 天前
Rust并发编程实践:10分钟入门系统级编程
python·算法·rust
放羊郎2 天前
CUDA兼容NVIDA版本关系
开发语言·后端·rust
zdsji2 天前
如何制作安装包打包软件
算法·rust·vue
Hello.Reader2 天前
Rust 中的引用循环与内存泄漏
开发语言·windows·rust