please ensure that VS 2013, VS 2

2021-02-22  本文已影响0人  我爱张智容

windows上做Rust开发编译运行提示:
please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed with the Visual C++ option

StackOverflow 解决方案:
https://stackoverflow.com/questions/55603111/unable-to-compile-rust-hello-world-on-windows-linker-link-exe-not-found

Case 1: Using C++ win compiler, to fix it you need to reinstall VS build tool C++

Download the Visual Studio 2019 Build tools from the Microsoft website: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16

After the download, while installing the Build tools, make sure that you install the required components:

  1. C++ build tools (这个根本没找到,太难了???)

This will download required files. Once everything is successfully installed, reboot and re-run your rust program and it will compile successfully.

Case2: This error can come from the fact that you use GCC to compile, to fix it (assume that you already have MinGW):

Tape in cmd: (本人最后选择了这个。最方便了)

  1. rustup uninstall toolchain stable-x86_64-pc-windows-msvc
  2. rustup toolchain install stable-x86_64-pc-windows-gnu (or download rustup-init for the platform of your choice at https://forge.rust-lang.org/infra/other-installation-methods.html)
  3. rustup default stable-x86_64-pc-windows-gnu

Case 3: You don't want to download Visual studio with build tools, simply install MinGw with g++ gcc development packages, then run CASE 2

上一篇下一篇

猜你喜欢

热点阅读