Cargo 找不到 msvc 链接器

问题描述 投票:0回答:1

我正在尝试在 Windows 上使用 rust,并且我已经安装了 Visual Studio,并切换了“使用 C++ 进行桌面开发”。看这个图片:

我什至已将链接器添加到我的路径中并可以通过 PowerShell 运行它:

PS C:\Users\themo\git\glow> link
Microsoft (R) Incremental Linker Version 14.38.33135.0
Copyright (C) Microsoft Corporation.  All rights reserved.

 usage: LINK [options] [files] [@commandfile]

...

货物却找不到...我错过了什么?

PS C:\Users\themo\git\glow> cargo run -r
   Compiling proc-macro2 v1.0.76
   Compiling serde v1.0.195
   Compiling crossbeam-utils v0.8.17
   Compiling windows_x86_64_msvc v0.48.5
error: linker `C:/usr/local/bin/lld` not found
  |
  = note: The system cannot find the path specified. (os error 3)

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: could not compile `windows_x86_64_msvc` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `serde` (build script) due to 1 previous error
error: could not compile `crossbeam-utils` (build script) due to 1 previous error
error: could not compile `proc-macro2` (build script) due to 1 previous error
windows rust visual-c++ rust-cargo
1个回答
0
投票

我发现一个 .cargo/config.toml 文件将链接器设置为错误的路径。删除文件后就可以了!

© www.soinside.com 2019 - 2024. All rights reserved.