简体   繁体   English

Microsoft C ++编译器,严重错误C1083:无法打开包含文件“ stdio.h”

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

I have the following C file. 我有以下C文件。

#include <stdio.h>

I open an instance of Developer Command Prompt for VS 2017 and type the command. 我为VS 2017打开了一个开发人员命令提示符实例,然后键入命令。

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. 我不确定如何解决此问题。

The include directories for the current session are stored in the INCLUDE environment variable. 当前会话的包含目录存储在INCLUDE环境变量中。

You can view this by typing echo %INCLUDE% on the command prompt. 您可以通过在命令提示符下键入echo %INCLUDE%来查看此内容。

To add a directory to the include path, use the command set INCLUDE=%INCLUDE%;C:\\foo\\bar . 要将目录添加到包含路径,请使用命令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. 但是,事实是编译器没有找到像<stdio.h>这样的标准且无处不在的标头,这表明Visual Studio安装存在严重问题。 I would run a repair install if I were you. 如果您是我,我会进行修复安装。

The include path needs to be set up, did you launch cmd with one of the developer command prompts? 需要设置包含路径,您是否使用开发人员命令提示符之一启动cmd?

Visual Studio 2017
 |---------Developer Command Prompt for Visual Studio
 |---------x64 Native Tools Command Prompt for Visual Studio
 |---------x64_x86 Cross Tools Command Prompt for Visual Studio
 |---------x86 Native Tools Command Prompt for Visual Studio
 |---------x64_x86 Cross Tools Command Prompt for Visual Studio

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM