C++ 致命错误 C1034:windows.h:未设置包含路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/931652/
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
fatal error C1034: windows.h: no include path set
提问by Kb.
OS Windows Vista Ultimate
操作系统 Windows Vista Ultimate
trying to run a program called minimal.c when i type at command line
当我在命令行输入时试图运行一个名为 minimum.c 的程序
C:\Users\nathan\Desktop>cl minimal.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. minimal.c minimal.c(5) : fatal error C1034: windows.h: no include path set
I have set all the paths:
我已经设置了所有路径:
C:\Users\nathan\Desktop>path PATH=C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin;C:\Windows\system3 ;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\ATI Technologies\AT .ACE\Core-Static;C:\Program Files\Intel\DMIX;c:\Program Files (x86)\Microsoft S L Server0\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server0\DTS\Bi n\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Java\jdk1. .0_13\bin;C:\Program Files (x86)\Autodesk\Backburner\;C:\Program Files (x86)\Co mon Files\Autodesk Shared\;C:\Program Files (x86)\Microsoft DirectX SDK (March 009)\Include;C:\Users\nathan\Desktop\glut-3.7.6-bin\glut-3.7.6-bin;C:\Program F les (x86)\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files (x86)\Microsof Visual Studio 8\VC\PlatformSDK\Include;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Include\gl
I have gone and made sure windows.h is in the directory im setting the path too. its in C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Include.
我已经确保 windows.h 也在我设置路径的目录中。它位于 C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Include。
I have visual studio 2005
我有 Visual Studio 2005
I have exhausted all possibilities any ideas
我已经用尽了所有的可能性任何想法
回答by Kb.
You could also run the vcvars32.bat file from the directory C:\Program Files\Microsoft Visual Studio 8\VC\bin (this is in your path) prior to your cl command.
Like this:
您还可以在执行 cl 命令之前从目录 C:\Program Files\Microsoft Visual Studio 8\VC\bin(在您的路径中)运行 vcvars32.bat 文件。
像这样:
C:\Users\nathan\Desktop>vcvars32
C:\Users\nathan\Desktop>cl minimal.c
vcvars32 calls C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat which sets up the required environment for compiling and linking.
The environment variables are:
INCLUDE, LIB and PATH
The compiler looks for header files in the INCLUDE path during compile,
and libraries are fetched from the LIB path during link.
vcvars32 调用 C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat 设置编译和链接所需的环境。
环境变量有:
INCLUDE、LIB 和PATH
编译器在编译时在INCLUDE 路径中寻找头文件,
在链接时从LIB 路径中获取库。
回答by khaverim
回答by 1800 INFORMATION
When you started the command line, did you run the included command line shortcut that comes with the Visual Studio setup? This will set the correct environment variables for you so that the compilation will work correctly.
当您启动命令行时,您是否运行了 Visual Studio 安装程序附带的命令行快捷方式?这将为您设置正确的环境变量,以便编译正常工作。
回答by sean e
You've added your INCLUDE paths to your PATH environment variable. Use vcvars32.bat as the others have suggested.
您已将 INCLUDE 路径添加到 PATH 环境变量中。按照其他人的建议使用 vcvars32.bat。
回答by aziz
your path variable might be too long, windows cant take more than 1023 characters in PATH variable
您的路径变量可能太长,Windows 在 PATH 变量中不能超过 1023 个字符