问题描述
我无法从Windows 10中的命令行提示符运行Microsoft Visual Studio C ++编译器"cl".我正在使用新的Windows 10安装和新的Microsoft Visual Studio 2017社区版本.
I am unable to run 'cl', the Microsoft Visual Studio C++ compiler, from a command line prompt in Windows 10. I am using a new Windows 10 installation and a new Microsoft Visual Studio 2017 community edition.
我得到错误:'cl'不被识别为内部或外部命令.
I get the error: 'cl' is not recognized as an internal or external command.
我尝试从两个不同的提示中运行它:
I have tried to run it from within two different prompts:
- 从Windows的开始"菜单中,选择开发人员命令提示符".
- 我向Visual Studio添加了一个选项,以按照以下建议添加开发人员命令提示符作为外部工具: https://community.dynamics.com/nav/b/navvanvugts/archive/2017/03/13/如何添加视觉工作室命令提示符到视觉工作室
都不起作用.每次都会出现上述错误.
Neither worked. Each time gives the above error.
Web上有许多关于此问题的线程,但是它们似乎都具有这样的特征,即所提供的信息对于我和他人的系统而言不准确或不最新.(这在早期版本的Visual Studio上很好用,但是显然Microsoft在不更新或测试文档的情况下更改了其2017版的许多位置/脚本,因此应用程序和在线中的现有文档对于不同的建议是一堆混乱的建议版本的Visual Studio).
There are many threads about this issue on the web but they all seem to share the characteristic that the information given is not accurate or current for my and others' systems. (This worked fine with earlier versions of Visual Studio, but apparently Microsoft changed many of their locations/scripts for the 2017 version without updating or testing the documentation, so existing documentation, in the app and online, is a mishmash of inconsistent advice for different versions of Visual Studio).
我的问题是:从新的Windows 10安装中,如何从命令行访问Microsoft C ++编译器?
My question is: from a new Windows 10 installation, how can I access the Microsoft C++ compiler from the command line?
推荐答案
这在VS2017中确实已被打破.微软知道AFAICT.
This is indeed broken in VS2017. AFAICT, Microsoft is aware.
您仍然可以通过注视常规命令提示符并运行 Common7 \ Tools \ VsDevCmd.bat
来创建类似的环境.通常可以在 C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community
中找到(最后一部分取决于VS2017版本).
You can still create a similar environment by staring a regular command prompt, and running Common7\Tools\VsDevCmd.bat
. This is usually found in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
(where the last part depends on the VS2017 version).
这篇关于Visual Studio 2017命令行提示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!