我收到以下错误:
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
vcvars32.bat设置的包含路径为:
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;
请注意,环境变量中的路径是“ C:\ Program Files(x86)\ Windows Kits \ 10 \ include \ wdf \ winrt; ”等。但是,文件的实际位置是 C:\ Program Files(x86)\ Windows Kits \ 10 \ include \ 10.0.10240.0 \ winrt;
我在这里做错了吗?非常感谢任何帮助。
P.S。我的真正目的是构建boost 1.58库(但它遇到了与上面相同的问题,所以首先要解决问题)。
p.p.s。我注意到以下环境变量。但是我无法改变它们。
WindowsSDKLibVersion=wdf\
WindowsSDKVersion=wdf\
答案 0 :(得分:15)
如果安装了WDK(Windows驱动程序工具包 - 10.0.26639),则会遇到此问题,因为WDK会覆盖包含路径。要使其工作,您必须卸载WDK,它应该可以工作。
查看Microsoft Connect问题 - https://connect.microsoft.com/VisualStudio/feedback/details/1610302/universalcrt-detection-breaks-when-windows-driver-kit-is-installed
答案 1 :(得分:4)
在我的情况下,我将这些路径添加到其他包含路径:
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)
并将这些路径添加到其他lib路径:
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)
答案 2 :(得分:4)
在针对Windows SDK 8.1构建VC ++项目时,我在VS2017(15.5.5)上遇到了类似的问题:
C1083无法打开包含文件:' assert.h':没有这样的文件或目录
在VS安装程序中检查<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %>.</h2>
<p>Your app description page.</p>
<p>Use this area to provide additional information.</p>
<asp:Image ID="Image3" runat="server" />
</asp:Content>
解决了问题。