英文:
error: linker `link.exe` not found (VS BuildTools installed)
问题
Output:
C:/Users/lennard/.cargo/bin/cargo.exe build --color=always --message-format=json-diagnostic-rendered-ansi --package untitled --bin untitled
正在编译 untitled v0.1.0 (C:\Users\lennard\CLionProjects\untitled)
错误: 找不到链接器 `link.exe`
|
= 提示:未找到程序
注意:msvc 目标依赖于 msvc 链接器,但未找到 `link.exe`
注意:请确保已安装 Visual Studio 2017 或更高版本,或者使用 Visual C++ 选项安装了 Visual Studio 的构建工具。
注意:VS Code 是不同的产品,不足以满足要求。
错误: 由于之前的错误,终止编译
错误: 由于 2 个先前的错误,无法编译 `untitled`(bin "untitled")
进程以退出代码 101 结束
Please note that the code part you provided is in English and doesn't need translation.
英文:
Code:
fn main() {
println!("Hello, world!");
}
Output:
C:/Users/lennard/.cargo/bin/cargo.exe build --color=always --message-format=json-diagnostic-rendered-ansi --package untitled --bin untitled
Compiling untitled v0.1.0 (C:\Users\lennard\CLionProjects\untitled)
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 previous error
error: could not compile `untitled` (bin "untitled") due to 2 previous errors
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
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论