Search code examples
cvisual-studio-2017

Microsoft C++ Compiler, Fatal Error C1083: Cannot open include file 'stdio.h'


I have the following C file.

#include <stdio.h>

I open an instance of Developer Command Prompt for VS 2017 and type the command.

cl [my-file.c]

I get the following error message

fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory.

I am unsure how to resolve this problem.


Solution

  • The include directories for the current session are stored in the INCLUDE environment variable.

    You can view this by typing echo %INCLUDE% on the command prompt.

    To add a directory to the include path, use the command set INCLUDE=%INCLUDE%;C:\foo\bar.

    The fact, however, that the compiler isn't finding a standard and ubiquitous header like <stdio.h> indicates a serious problem with your Visual Studio installation. I would run a repair install if I were you.