错误: 找不到链接器 `link.exe`(已安装VS BuildTools)

huangapple go评论193阅读模式
英文:

error: linker `link.exe` not found (VS BuildTools installed)

问题

Output:

  1. C:/Users/lennard/.cargo/bin/cargo.exe build --color=always --message-format=json-diagnostic-rendered-ansi --package untitled --bin untitled
  2. 正在编译 untitled v0.1.0 (C:\Users\lennard\CLionProjects\untitled)
  3. 错误: 找不到链接器 `link.exe`
  4. |
  5. = 提示:未找到程序
  6. 注意:msvc 目标依赖于 msvc 链接器,但未找到 `link.exe`
  7. 注意:请确保已安装 Visual Studio 2017 或更高版本,或者使用 Visual C++ 选项安装了 Visual Studio 的构建工具。
  8. 注意:VS Code 是不同的产品,不足以满足要求。
  9. 错误: 由于之前的错误,终止编译
  10. 错误: 由于 2 个先前的错误,无法编译 `untitled`bin "untitled"
  11. 进程以退出代码 101 结束

Please note that the code part you provided is in English and doesn't need translation.

英文:

Code:

  1. fn main() {
  2. println!("Hello, world!");
  3. }

Output:

  1. C:/Users/lennard/.cargo/bin/cargo.exe build --color=always --message-format=json-diagnostic-rendered-ansi --package untitled --bin untitled
  2. Compiling untitled v0.1.0 (C:\Users\lennard\CLionProjects\untitled)
  3. error: linker `link.exe` not found
  4. |
  5. = note: program not found
  6. note: the msvc targets depend on the msvc linker but `link.exe` was not found
  7. note: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option.
  8. note: VS Code is a different product, and is not sufficient.
  9. error: aborting due to previous error
  10. error: could not compile `untitled` (bin "untitled") due to 2 previous errors
  11. Process finished with exit code 101`

I've installed the VS Build Tools with the "Desktop development with C++"... I am able to find various link.exe manually:

  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x86\link.exe
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64\link.exe
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\Hostarm64\x86\link.exe
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\Hostarm64\x64\link.exe
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\Hostx86\x64\link.exe
  • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\Hostx86\x86\link.exe

错误: 找不到链接器 `link.exe`(已安装VS BuildTools)

答案1

得分: 0

我最终通过设置一个新的干净虚拟机,安装了桌面开发与C++,运行了rustup-init,现在它可以编译而没有进一步的错误。

之前的问题原因不明。

英文:

I've finally solved the issue 🎉 by setting up a new clean VM, installed Desktop development with C++, ran the rustup-init and now it compiles without further errors.

No idea what caused the previous issues.

huangapple
  • 本文由 发表于 2023年8月10日 23:04:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76877017.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定