Nilay Kothari
Nilay Kothari

Reputation: 181

VS2015 cl Can't find CRT libs (stdio.h, ctype.h etc.) when building on command line

I get the following error:

c:\test>cl helloworld.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

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

The include paths set by the vcvars32.bat are:

INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\10\include\wdf\ucrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um;C:\Program Files (x86)\Windows Kits\10\include\wdf\shared;C:\Program Files (x86)\Windows Kits\10\include\wdf\um;C:\Program Files (x86)\Windows Kits\10\include\wdf\winrt;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\10\include\wdf\ucrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um;C:\Program Files (x86)\Windows Kits\10\include\wdf\shared;C:\Program Files (x86)\Windows Kits\10\include\wdf\um;C:\Program Files (x86)\Windows Kits\10\include\wdf\winrt;

Note that the paths in the environment variable are "C:\Program Files (x86)\Windows Kits\10\include\wdf\winrt;" etc. However, the actual location of the files is C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt;

Am I doing something wrong here? Any help greatly appreciated.

p.s. My real purpose is to build the boost 1.58 library (but it suffers from the same issue as above, so first wanted to isolate the problem).

p.p.s. I noticed the following environment variables. But I'm unable to change them.

WindowsSDKLibVersion=wdf\
WindowsSDKVersion=wdf\

Upvotes: 18

Views: 29442

Answers (4)

Yurii
Yurii

Reputation: 11

I ran into a similar problem on VS2022 when building VC++ projects against
Windows SDK.
You need to open "Visual Studio Installer" and modify the components.
To get this to work, you must uninstall
Windows Universal CRT SDK
and it should work.
enter image description here

Upvotes: 1

AhmedBM
AhmedBM

Reputation: 1290

If you have WDK (Windows Driver Kit - 10.0.26639) installed you will encounter this issue as the include paths are overwritten by the WDK. To get this to work, you must uninstall the WDK and it should work.

Upvotes: 16

zwcloud
zwcloud

Reputation: 4889

I ran into a similar problem on VS2017 (15.5.5) when building VC++ projects against Windows SDK 8.1:

C1083 Cannot open include file: 'assert.h': No such file or directory

Checking Windows 8.1 SDK and UCRT SDK in the VS installer solved the problem. Windows 8.1 SDK and UCRT SDK

Upvotes: 5

전송현
전송현

Reputation: 71

In my case, I added these paths to the additional include path:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\Include\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\winrt;$(IncludePath)

and added these paths to the additional lib path:

C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ucrt\x86;$(LibraryPath)

Upvotes: 7

Related Questions