在 Windows 系统上运行 Rust 程序时未发现 link.exe 错误,Cargo 是否必须使用 Visual C++? [英] link.exe not found error while running on windows system for rust program, is Visual C++ mandatory for Cargo?

查看:52
本文介绍了在 Windows 系统上运行 Rust 程序时未发现 link.exe 错误,Cargo 是否必须使用 Visual C++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了找不到link.exe的问题,还有什么我需要安装的吗?

I am getting link.exe not found issue , is there anything more i have to install?

PS C:\Users\parik> 货物新测试2创建的二进制(应用程序)test2 项目 PS C:\Users\parik> 货物构建错误:在 C:\Users\parik<中找不到 Cargo.toml/code> 或任何父目录 PS C:\Users\parik> cd test2 PSC:\Users\parik\test2> cargo build 编译 test2 v0.1.0(C:\Users\parik\test2) 错误:找不到链接器 link.exe |=注意:系统找不到指定的文件.(操作系统错误 2)

PS C:\Users\parik> cargo new test2 Created binary (application) test2 project PS C:\Users\parik> cargo build error: could not find Cargo.toml in C:\Users\parik or any parent directory PS C:\Users\parik> cd test2 PS C:\Users\parik\test2> cargo build Compiling test2 v0.1.0 (C:\Users\parik\test2) error: linker link.exe not found | = note: The system cannot find the file specified. (os error 2)

注意:msvc 目标取决于 msvc 链接器,但 link.exe 是未找到

note: the msvc targets depend on the msvc linker but link.exe was not found

注意:请确保已安装 VS 2013、VS 2015 或 VS 2017使用 Visual C++ 选项

note: please ensure that VS 2013, VS 2015 or VS 2017 was installed with the Visual C++ option

错误:由于先前的错误而中止

error: aborting due to previous error

错误:无法编译test2.

推荐答案

为 Windows 提供了两个现有的 Rust 工具链系列:

There are two existing Rust toolchain families provided for Windows:

  • msvc
  • gnu

msvc 是默认设置,正如您所意识到的,取决于最近安装的 Visual C++.

msvc is the default, and as you realized, depends on a recent Visual C++ installation.

gnu 另一方面取决于 GNU/MinGW-w64.可以使用以下方法安装它并使其成为默认工具链:

gnu on the other hand depends on GNU/MinGW-w64. It can be installed and made the default toolchain using:

$ rustup default stable-x86_64-pc-windows-gnu

这篇关于在 Windows 系统上运行 Rust 程序时未发现 link.exe 错误,Cargo 是否必须使用 Visual C++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆