link.exe not found error while running on windows system for rust program, is Visual C++ mandatory for Cargo?

三世轮回 提交于 2020-06-23 04:35:20

问题


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

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)

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

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

error: aborting due to previous error

error: Could not compile test2.


回答1:


There are two existing Rust toolchain families provided for Windows:

  • msvc
  • gnu

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

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



回答2:


Yes, you have to install VC+ build tools so that rustc should be able to autodetect the helper files. Or you can go with the VS 2013 or 2015(for autodetection). For more information please refer this.



来源:https://stackoverflow.com/questions/59171127/link-exe-not-found-error-while-running-on-windows-system-for-rust-program-is-vi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!