Day 001 - Setting Up the Windows Build - "fatal error C1083: Cannot open include file: 'windows.h': No such file or directory"

I've installed Visual Studio 2017 Community Edition, with a lot of modules installed, just to be sure safe. And everything compiled just fine when we build it from visual studio.
1
2
3
4
5
6
#include <windows.h>

int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
  return(0);
}


However when compiling through a bat file, using cl fileName.cpp I get the following error:

Here is the relevant part of my setup.bat

1
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall" x64


And when I try and run
1
cl win32_handmade.cpp


I get the following error
1
2
3
4
5
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25834 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

win32_handmade.cpp
win32_handmade.cpp(1): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory


I've been stuck for hours on this one, could anyone point me in the right direction?

So far so good. Stuck on day one :D Only 500 days left. No, but really, I'm so excited about this series!



Edited by Bjarke Elias on
Either you're missing Windows.h in the Visual Studio directory, or you don't have access to it.

In the console after calling setup.bat, could you type "set" ?
It should print a list of your environment variables. In those there should be one called INCLUDE and it should look something like this:
1
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt;

If it does, could you look in one of those folder if there is a file called Windows.h (should be in C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um ). If there isn't you may want to try reinstalling Visual Studio.

If the file is present, you may not have access to it. Close any program that might have a lock on the file. Try running your command prompt with administrator privilege (normally it's not necessary).

As a test, you might also try to copy the windows.h file in your code directory and change
1
2
3
#include <windows.h>
by
#include "windows.h"

But I wouldn't recommend that as a permanent solution (and since that file include other files it might not work).

Note that at least two peoples had issues recently with that error with files they have access to (here and here) but those file were not Visual Studio files.
I suspect OP simply doesn't have correct Windows SDK installed. There is no need to reinstall whole Visual Studio. Just run installer and check if you have "Windows 10 SDK (10.0.16299.0) for Desktop C++ [x86 and x64]" installed.
Thanks a bunch!

This is what was in my include when I typed in SET:

1
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include;


I then modified it to match the one you provided:

1
set INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt


Only changed one version number, to match the one I have installed. Otherwise, all paths are valid, and windows.h do exist in the um folder.

And now when I run cl win32_handmade.cpp I get:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
cl win32_handmade.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25834 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

win32_handmade.cpp
Microsoft (R) Incremental Linker Version 14.12.25834.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:win32_handmade.exe
win32_handmade.obj
LINK : fatal error LNK1104: cannot open file 'uuid.lib'

d:\CTest\code>


I'll continue to investigate and check out the posts you've linked. Thanks again for getting me closer.

Edited by Bjarke Elias on
mmozeiko
I suspect OP simply doesn't have correct Windows SDK installed. There is no need to reinstall whole Visual Studio. Just run installer and check if you have "Windows 10 SDK (10.0.16299.0) for Desktop C++ [x86 and x64]" installed.


You are probably right. I'll try and install that one instead :) https://jumpshare.com/v/wEuSEPGocSU9a2xSeEsx

Edited by Bjarke Elias on
No luck :/ Same error. It did get another default set INLCUDE - after running the vcvarsall x64 with the new SDK.

Which looks like this:

[Code]"INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include;"[/Code]

But no windows.h is located in any of those folders, and if I manually add the INCLUDE path to where windows.h is located, I get the cannot open file 'uuid.lib' again.
Try installing "Windows 8.1 SDK" and then running
1
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall" x64 8.1

Tried, That gave me:

1
2
3
4
5
6
7
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.5.3
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[ERROR:winsdk.bat] Windows SDK 8.1 : 'include' not found
The system cannot find the path specified.
[ERROR:VsDevCmd.bat] *** VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. ***


Tried installing everything that sounded slightly relevant, but still get all of the above errors as before. Perhaps format c: would be a good command to run at this point^^

Edited by Bjarke Elias on
Did you install everything in default locations? I believe VS doesn't like when it is installed in custom location.
Do you maybe have bad anti-virus running in background that blocks something?

Can you check registry for folliwing values in HKEY_LOCAL_MACHINE\Software\Wow6432Node\Micosoft\Microsoft SDKs\Windows:
- does it have v10.0 with InstallationFolder key pointing to "C:\Program Files (x86)\Windows Kits\10" ?
- does it have v8.1 with InstallationFolder key pointing to "C:\Program Files (x86)\Windows Kits\8.1 ?

Do both of these folders contain "include\um" and "lib\VERSION\um\x64" folders?
mmozeiko
Did you install everything in default locations? I believe VS doesn't like when it is installed in custom location.
Do you maybe have bad anti-virus running in background that blocks something?

Can you check registry for folliwing values in HKEY_LOCAL_MACHINE\Software\Wow6432Node\Micosoft\Microsoft SDKs\Windows:
- does it have v10.0 with InstallationFolder key pointing to "C:\Program Files (x86)\Windows Kits\10" ?
- does it have v8.1 with InstallationFolder key pointing to "C:\Program Files (x86)\Windows Kits\8.1 ?

Do both of these folders contain "include\um" and "lib\VERSION\um\x64" folders?


- I have not installed anything at a custom location, have installed.
- Both keys looks good in regedit
- Tried disabling both windows firewall and virus protection - still same error ": fatal error LNK1104: cannot open file 'uuid.lib'"
- both "include\um" and "lib\VERSION\um\x64" exists in C:\Program Files (x86)\Windows Kits\VERSION\

Do I have a bad vcvarsall.bat maybe?

Don't know if this might be relevant, but this is what my SET's looks like after running
1
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall" x64 8.1

and
1
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall" x64


Where the difference is this: https://jumpshare.com/v/StKVmqITRsFUqsxgRIoh


For :
1
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall" x64 8.1


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
ALLUSERSPROFILE=
   C:\ProgramData
APPDATA=
   C:\Users\Bjarke\AppData\Roaming
CommandPromptType=
   Native
CommonProgramFiles=
   C:\Program Files\Common Files
CommonProgramFiles(x86)=
   C:\Program Files (x86)\Common Files
CommonProgramW6432=
   C:\Program Files\Common Files
COMPUTERNAME=
   DESKTOP-M7R6QQG
ComSpec=
   C:\WINDOWS\system32\cmd.exe
DevEnvDir=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\
DEVPATH=
   C:\ProgramData\Red Gate\.NET Reflector\DevPath
ExtensionSdkDir=
   C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs
FPS_BROWSER_APP_PROFILE_STRING=
   Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=
   Default
Framework40Version=
   v4.0
FrameworkDir=
   C:\Windows\Microsoft.NET\Framework64\
FrameworkDir64=
   C:\Windows\Microsoft.NET\Framework64\
FrameworkVersion=
   v4.0.30319
FrameworkVersion64=
   v4.0.30319
FSHARPINSTALLDIR=
   C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\
GTK_BASEPATH=
   C:\Program Files (x86)\GtkSharp\2.12\
HOMEDRIVE=
   C:
HOMEPATH=
   \Users\Bjarke
INCLUDE=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\ATLMFC\include;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include;
   
LIB=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\ATLMFC\lib\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib\x64;
   
LIBPATH=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\ATLMFC\lib\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib\x86\store\references;
   C:\Windows\Microsoft.NET\Framework64\v4.0.30319;
   
LOCALAPPDATA=
   C:\Users\Bjarke\AppData\Local
LOGONSERVER=
   \\DESKTOP-M7R6QQG
NUMBER_OF_PROCESSORS=
   8
OneDrive=
   C:\Users\Bjarke\OneDrive
OS=
   Windows_NT
Path=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCPackages;
   C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.5;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\Roslyn;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Performance Tools\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Performance Tools;
   C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\MSBuild\15.0\bin;
   C:\Windows\Microsoft.NET\Framework64\v4.0.30319;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\;
   d:\CTest;
   
PATHEXT=
   .COM;
   .EXE;
   .BAT;
   .CMD;
   .VBS;
   .VBE;
   .JS;
   .JSE;
   .WSF;
   .WSH;
   .MSC
Platform=
   x64
PROCESSOR_ARCHITECTURE=
   AMD64
PROCESSOR_IDENTIFIER=
   Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=
   6
PROCESSOR_REVISION=
   3c03
ProgramData=
   C:\ProgramData
ProgramFiles=
   C:\Program Files
ProgramFiles(x86)=
   C:\Program Files (x86)
ProgramW6432=
   C:\Program Files
PROMPT=
   $P$G
PSModulePath=
   C:\Program Files\WindowsPowerShell\Modules;
   C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=
   C:\Users\Public
SESSIONNAME=
   Console
SystemDrive=
   C:
SystemRoot=
   C:\WINDOWS
TEMP=
   C:\Users\Bjarke\AppData\Local\Temp
TMP=
   C:\Users\Bjarke\AppData\Local\Temp
USERDOMAIN=
   DESKTOP-M7R6QQG
USERDOMAIN_ROAMINGPROFILE=
   DESKTOP-M7R6QQG
USERNAME=
   Bjarke
USERPROFILE=
   C:\Users\Bjarke
VBOX_MSI_INSTALL_PATH=
   C:\Program Files\Oracle\VirtualBox\
VCIDEInstallDir=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\
VCINSTALLDIR=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\
VCToolsInstallDir=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\
VCToolsRedistDir=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.12.25810\
VCToolsVersion=
   14.12.25827
VisualStudioVersion=
   15.0
VS140COMNTOOLS=
   C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
VS150COMNTOOLS=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\
VSCMD_ARG_app_plat=
   Desktop
VSCMD_ARG_HOST_ARCH=
   x64
VSCMD_ARG_TGT_ARCH=
   x64
VSCMD_ARG_winsdk=
   8.1
VSCMD_VER=
   15.5.3
VSINSTALLDIR=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\
VSSDK150INSTALL=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VSSDK
windir=
   C:\WINDOWS
WindowsLibPath=
   References\CommonConfiguration\Neutral
WindowsSDKLibVersion=
   winv6.3\
__DOTNET_ADD_64BIT=
   1
__DOTNET_PREFERRED_BITNESS=
   64
__VSCMD_PREINIT_PATH=
   d:\CTest;
   



And for:
1
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall" x64

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
ALLUSERSPROFILE=
   C:\ProgramData
APPDATA=
   C:\Users\Bjarke\AppData\Roaming
CommandPromptType=
   Native
CommonProgramFiles=
   C:\Program Files\Common Files
CommonProgramFiles(x86)=
   C:\Program Files (x86)\Common Files
CommonProgramW6432=
   C:\Program Files\Common Files
COMPUTERNAME=
   DESKTOP-M7R6QQG
ComSpec=
   C:\WINDOWS\system32\cmd.exe
DevEnvDir=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\
DEVPATH=
   C:\ProgramData\Red Gate\.NET Reflector\DevPath
ExtensionSdkDir=
   C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs
FPS_BROWSER_APP_PROFILE_STRING=
   Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=
   Default
Framework40Version=
   v4.0
FrameworkDir=
   C:\Windows\Microsoft.NET\Framework64\
FrameworkDir64=
   C:\Windows\Microsoft.NET\Framework64\
FrameworkVersion=
   v4.0.30319
FrameworkVersion64=
   v4.0.30319
FSHARPINSTALLDIR=
   C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\
GTK_BASEPATH=
   C:\Program Files (x86)\GtkSharp\2.12\
HOMEDRIVE=
   C:
HOMEPATH=
   \Users\Bjarke
INCLUDE=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\ATLMFC\include;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include;
   
LIB=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\ATLMFC\lib\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib\x64;
   
LIBPATH=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\ATLMFC\lib\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib\x86\store\references;
   C:\Windows\Microsoft.NET\Framework64\v4.0.30319;
   
LOCALAPPDATA=
   C:\Users\Bjarke\AppData\Local
LOGONSERVER=
   \\DESKTOP-M7R6QQG
NUMBER_OF_PROCESSORS=
   8
OneDrive=
   C:\Users\Bjarke\OneDrive
OS=
   Windows_NT
Path=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCPackages;
   C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.5;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\Roslyn;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Performance Tools\x64;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Performance Tools;
   C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\MSBuild\15.0\bin;
   C:\Windows\Microsoft.NET\Framework64\v4.0.30319;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\;
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\;
   d:\CTest;
   
PATHEXT=
   .COM;
   .EXE;
   .BAT;
   .CMD;
   .VBS;
   .VBE;
   .JS;
   .JSE;
   .WSF;
   .WSH;
   .MSC
Platform=
   x64
PROCESSOR_ARCHITECTURE=
   AMD64
PROCESSOR_IDENTIFIER=
   Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=
   6
PROCESSOR_REVISION=
   3c03
ProgramData=
   C:\ProgramData
ProgramFiles=
   C:\Program Files
ProgramFiles(x86)=
   C:\Program Files (x86)
ProgramW6432=
   C:\Program Files
PROMPT=
   $P$G
PSModulePath=
   C:\Program Files\WindowsPowerShell\Modules;
   C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=
   C:\Users\Public
SESSIONNAME=
   Console
SystemDrive=
   C:
SystemRoot=
   C:\WINDOWS
TEMP=
   C:\Users\Bjarke\AppData\Local\Temp
TMP=
   C:\Users\Bjarke\AppData\Local\Temp
USERDOMAIN=
   DESKTOP-M7R6QQG
USERDOMAIN_ROAMINGPROFILE=
   DESKTOP-M7R6QQG
USERNAME=
   Bjarke
USERPROFILE=
   C:\Users\Bjarke
VBOX_MSI_INSTALL_PATH=
   C:\Program Files\Oracle\VirtualBox\
VCIDEInstallDir=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\
VCINSTALLDIR=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\
VCToolsInstallDir=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\
VCToolsRedistDir=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.12.25810\
VCToolsVersion=
   14.12.25827
VisualStudioVersion=
   15.0
VS140COMNTOOLS=
   C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
VS150COMNTOOLS=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\
VSCMD_ARG_app_plat=
   Desktop
VSCMD_ARG_HOST_ARCH=
   x64
VSCMD_ARG_TGT_ARCH=
   x64
VSCMD_VER=
   15.5.3
VSINSTALLDIR=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\
VSSDK150INSTALL=
   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VSSDK
windir=
   C:\WINDOWS
WindowsLibPath=
   References\CommonConfiguration\Neutral
WindowsSDKLibVersion=
   winv6.3\
WindowsSDKVersion=
   \
__DOTNET_ADD_64BIT=
   1
__DOTNET_PREFERRED_BITNESS=
   64
__VSCMD_PREINIT_PATH=
   d:\CTest;
   

Edited by Bjarke Elias on
Your PATH seems to be broken. It normally should contain C:\Windows and C:\Windows\System32 folders as minimum. And bunch more depending on what software you have installed.

Are you overriding it somewhere?

Not sure if this is relevant to your issue... it could be that vsvarsall.bat cannot find some tool because PATH is broken, that's why it ignores finding & setting up SDK folders.

Edited by Mārtiņš Možeiko on
Here is how it looks before running vcvarsall:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
C:\ProgramData
APPDATA=C:\Users\Bjarke\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=DESKTOP-M7R6QQG
ComSpec=C:\WINDOWS\system32\cmd.exe
DEVPATH=C:\ProgramData\Red Gate\.NET Reflector\DevPath
FSHARPINSTALLDIR=C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\
GTK_BASEPATH=C:\Program Files (x86)\GtkSharp\2.12\
HOMEDRIVE=C:
HOMEPATH=\Users\Bjarke
LOCALAPPDATA=C:\Users\Bjarke\AppData\Local
LOGONSERVER=\\DESKTOP-M7R6QQG
NUMBER_OF_PROCESSORS=8
OneDrive=C:\Users\Bjarke\OneDrive
OS=Windows_NT
Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\Bjarke\AppData\Local\Microsoft\WindowsApps;;C:\Users\Bjarke\AppData\Local\Programs\Fiddler;C:\Program Files\Microsoft VS Code\bin;C:\Users\Bjarke\AppData\Roaming\npm
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3c03
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\Bjarke\AppData\Local\Temp
TMP=C:\Users\Bjarke\AppData\Local\Temp
USERDOMAIN=DESKTOP-M7R6QQG
USERDOMAIN_ROAMINGPROFILE=DESKTOP-M7R6QQG
USERNAME=Bjarke
USERPROFILE=C:\Users\Bjarke
VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
windir=C:\WINDOWS



I could try and uninstall everything again, and see if get a visual studio 1015 installer. Maybe that will install and setup things properly.

If that doesn't work, then I'll do the right thing and format c: and install Linux Mint^^ Which I've been wanting to switch to for a while. Can't wait to see what sort of problems I'll have then hehe. I could always follow the series on a VirtualBox on Linux.
How does "d:\CTest" get into PATH? Its not there by default. And I don't think vsvarsall.bat is setting it. I'm guessing that somebody who is putting d:\ctest into PATH is dropping all the other values.

Not sure if this is an issue, but you have empty folder in PATH - two semicolons next to each other.

Edited by Mārtiņš Možeiko on
mmozeiko
How does "d:\CTest" get into PATH? It's not there by default. And I don't think vsvarsall.bat is setting it. I'm guessing that somebody who is putting d:\ctest into PATH is dropping all the other values.


Oh god. That was it. I am so embarrasse! In my setup.bat, I was overriding the PATH.

1
2
3
set PATH=d:\CTest;
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall" x64
cd /d d:\CTest\code


I remember that I, to begin with, was overriding the path after calling vcvarsall, which gave an error when calling cl file.cpp. So I just moved the set path one line up, and though I've fixed the problem as it now sort of worked.

And I see now that I just forgot to add the %path% at the end.

Thank you so much for your help! Of course it was simply at the end. I should just have shared my entire setup.bat, to begin with^^ doh.