Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 command line prompt

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.

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:

  1. From the Windows Start menu, I selected, "developer command prompt".
  2. I added an option to Visual Studio to add a developer command prompt as an external tool following the suggestions here: https://community.dynamics.com/nav/b/navvanvugts/archive/2017/03/13/how-to-add-visual-studio-command-prompt-to-visual-studio

Neither worked. Each time gives the above error.

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).

My question is: from a new Windows 10 installation, how can I access the Microsoft C++ compiler from the command line?

like image 972
kdog Avatar asked Jan 09 '18 13:01

kdog


1 Answers

This is indeed broken in VS2017. AFAICT, Microsoft is aware.

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).

like image 86
MSalters Avatar answered Nov 20 '22 19:11

MSalters