Handmade Hero»Forums»Code
3 posts
cl doesn't work in VS 2017 even if it says the environment is initialized
Hi, I was using the visual studio 2015(which was working perfectly fine), then when I switched to visual studio 2017, this happened.

w:\handmade\misc>shell
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26430.16
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

w:\handmade\misc>cl
'cl'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.//This means it cannot run cl in korean

Although it says that the environment is initialized, cl command still does not work. What should I do?
Mārtiņš Možeiko
2559 posts / 2 projects
cl doesn't work in VS 2017 even if it says the environment is initialized
Are you sure you have installed C++ support in Visual Studio 2017? I believe it needs to be explicitly selected in installer.

Can you show PATH after you have called shell?

3 posts
cl doesn't work in VS 2017 even if it says the environment is initialized
Edited by EvulStd on
Thank you very much for replying!

I don't quite understand your meaning - 'path after you have called shell'

This is my shell.bat

@echo off
call "D:\VisualStudio2017\VC\Auxiliary\Build\vcvarsall.bat" x64
set path=w:\handmade\misc; %path%

Also, I installed these functions in Visual Studio 2017
(the name might be slightly different as I am using Korean)
1.Desktop Development using c++
2.Game Development using c++

With these features, I can currently make a empty console project in Visual Studio 2017 and compile this code.

#include <stdio.h>

int main(void)
{
return 0;
}
Mārtiņš Možeiko
2559 posts / 2 projects
cl doesn't work in VS 2017 even if it says the environment is initialized
Edited by Mārtiņš Možeiko on
I was asking to execute "PATH" command and show the output.

From the code you posted it looks like you have extra space here:
1
2
3
set path=w:\handmade\misc; %path%
                          ^
                          | here

Assuming "vcvarsall.bat" file set path to cl location as first item in list, this space will be prepended to folder location. Basically path afterwards will contain:
1. "w:\handmade\misc"
2. " c:\location\to\folder\where\is\cl.exe"
3. ... other items.

This will make cl.exe to not be found, because it will look for " c:\location\to\folder\where\is\cl.exe" location which does not exist.

Remove the space.

And next time please remember to post code in [ code ] bbtags so it is easier to read.

3 posts
cl doesn't work in VS 2017 even if it says the environment is initialized
It worked! Thank you so much.

I'll make sure to use tags from now on, too.
Again, thank you!