C# 致命错误 C1083 - 无法打开包含文件:“windows.h”:没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/80788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 11:18:33  来源:igfitidea点击:

Fatal Error C1083 - Cannot open include file: "windows.h": No such file or directory

提问by Epaga

I'm trying to get IKVM to build (see this question) but now have encountered a problem not having to do with IKVM so I'm opening up a new question:

我正在尝试构建 IKVM(请参阅此问题),但现在遇到了与 IKVM 无关的问题,因此我提出了一个新问题:

When running nant on the IKVM directory with the Visual Studio 2008 Command Prompt (from the Start Menu), I get the following error:

使用 Visual Studio 2008 命令提示符(从“开始”菜单)在 IKVM 目录上运行 nant 时,出现以下错误:

        ikvm-native-win32:

               [cl] Compiling 2 files to C:\ikvm-0.36.0.11\native\Release'.

               [cl] jni.c
               [cl] os.c
               [cl] C:\ikvm-0.36.0.11\native\os.c(25) : fatal error C1083: Cannot open include file: 'windows.h': No such
                    file or directory
               [cl] Generating Code...

        BUILD FAILED

        C:\ikvm-0.36.0.11\native\native.build(17,10):
        External Program Failed: cl (return code was 2)
        ikvm-native-win32:

               [cl] Compiling 2 files to C:\ikvm-0.36.0.11\native\Release'.

               [cl] jni.c
               [cl] os.c
               [cl] C:\ikvm-0.36.0.11\native\os.c(25) : fatal error C1083: Cannot open include file: 'windows.h': No such
                    file or directory
               [cl] Generating Code...

        BUILD FAILED

        C:\ikvm-0.36.0.11\native\native.build(17,10):
        External Program Failed: cl (return code was 2)

I have the Platform SDK installed. What am I missing? I'm sure it's something simple...

我安装了 Platform SDK。我错过了什么?我确定这很简单......

Edit #1I just checked - I do have the directory containing windows.h on the Path. Edit #2Found the answer (see my answer below): The directory containing windows.h needed to be in the "Include" path variable.

编辑 #1我刚刚检查过 - 我确实在路径上有包含 windows.h 的目录。 编辑 #2找到答案(请参阅下面的答案):包含 windows.h 的目录需要位于“包含”路径变量中。

采纳答案by Epaga

OK here is the answer I ended up finding: rather than being on the Path, the directory with windows.h (in my case, C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include) needed to be set in the Include environment variable.

好的,这是我最终找到的答案:而不是在路径上,需要设置 windows.h 目录(在我的情况下为 C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include)包含环境变量。

回答by abatishchev

By the way, create environment variable %LIB%, meaning the same - path to all SDKs lib directories

顺便说一下,创建环境变量 %LIB%,意思是相同的 - 所有 SDKs lib 目录的路径