Answer the question
In order to leave comments, you need to log in
How to add Visual Studio C++ compiler to powershell\cmd?
There is an installed Studio 2015.
Added to PATH C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe
Created a test program (Hello World). Cursing on startup cl test.cpp
:
test.cpp(1): fatal error C1034: iostream: не указан путь поиска включаемых файлов
Answer the question
In order to leave comments, you need to log in
You need to add the directory (C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin) to PATH, not cl.exe
But the error says that you have not specified the search path for INCLUDED files.
That is, cl.exe itself finds it. You need to add the /I or -I option indicating where the include files are
located cl.exe -Ic:\src test.cpp
The studio comes with a set of command scripts that configure the command line environment for the compiler to work. It is enough to run the command line through these scripts. Shortcuts to these scripts are located in the start menu in the studio folder.
For example, for VS2017 I have these:
x64 Native Tools Command Prompt for VS 2017
x86 Native Tools Command Prompt for VS 2017
Respectively for 64-bit and 32-bit assembly of applications. In 2015, there are similar studios, only the name is slightly changed.
Run command line through this script and everything will build.
Compiling from cmd via cl.exe - setting the necessary environment.
To set system variables to the global environment - add to Path and create Include, LIB .
And change to your versions of MSVC, Windows SDK and bit depth x86 or x64.
To check the variables - you can simply run from the start menu - x64 Native Tools Command Prompt for VS 2019 and type "set path" or "set lib", or "set include".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question