Unable to compile Rust hello world on Windows: linker link.exe not found

cargo build报错 

 1 Compiling helloworld v0.1.0 (C:\Users\DELL\helloworld)
 2 
 3 error: linker `link.exe` not found
 4 note: The system cannot find the file specified. (os error 2)
 5 note: the msvc targets depend on the msvc linker but `link.exe` was not found
 6 note: please ensure that VS 2013, VS 2015 or VS 2017 was installed with the Visual C++ option
 7 error: aborting due to previous error
 8 error: Could not compile `helloworld`.
 9 
10 To learn more, run the command again with --verbose.

 

解决:

  1. rustup toolchain install stable-x86_64-pc-windows-gnu

     

  2. rustup default stable-x86_64-pc-windows-gnu

     

结果:

  

PS E:\rust\hello_world> cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s

 

posted @ 2022-06-09 23:47  sliverMeng  阅读(121)  评论(0)    收藏  举报