当按照 https://kaisery.github.io/trpl-zh-cn/ch01-02-hello-world.html 学习教程编写第一个Helloworld。执行rustc命令后汇报如下错误
G:\rustspace>rustc main.rs
error: linker `link.exe` not found
|
= note: 系统找不到指定的文件。 (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, VS 2017 or VS 2019 was installed with the Visual C++ option
error: aborting due to previous error
截图如下:
解决办法:
下载安装 visualcppbuildtools_full.exe
安装步骤傻瓜式,双击exe文件,弹出下面的页面,直接默认下一步安装,也可以自定义安装,十几分钟就安装好了。然后再执行 rustc [文件名] 就能正确编译了
正确编译截图
编译后会生成两个文件 main.exe和 main.pdb
接下来执行exe文件就可以了:
visualcppbuildtools_full.exe的下载链接在第一条评论
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)