已安装VS Build Tools但编译Rust代码时提示link.exe未找到的问题求助
已安装VS Build Tools但编译Rust代码时提示link.exe未找到的问题求助
各位好,我最近在尝试编译一段简单的Rust代码时遇到了卡住的问题,想请教下大家有没有解决思路。
我写的测试代码很简单:
fn main() { println!("Hello, world!"); }
但编译时直接报了链接器找不到的错误,完整输出如下:
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
我已经严格按照提示安装了Visual Studio 2022 Build Tools,并且勾选了「Desktop development with C++」组件,甚至手动找到了多个link.exe的路径:
- 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
可编译的时候还是提示找不到这个链接器,有没有朋友遇到过同款问题?怎么才能让Rust正确识别到link.exe的位置呢?
备注:内容来源于stack exchange,提问作者Fauna Muirgen
相关产品推荐
相关产品推荐

