问题描述
- 我已经安装了最新的 VS2015 专业版.
- 打开 Visual Studio 命令提示符并运行 vcvars32.bat
- 编写了一个简单的 helloworld.cpp 程序(包括 stdio.h 并打印hello world")
- 试过cl helloworld.cpp
我收到以下错误:
c: est>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 设置的包含路径为:
The include paths set by the vcvars32.bat are:
INCLUDE=C:Program Files (x86)Microsoft Visual Studio 14.0VCINCLUDE;C:Program Files (x86)Microsoft Visual Studio 14.0VCATLMFCINCLUDE;C:Program Files (x86)Windows Kits10includewdfucrt;C:Program Files (x86)Windows KitsNETFXSDK4.6includeum;C:Program Files (x86)Windows Kits10includewdfshared;C:Program Files (x86)Windows Kits10includewdfum;C:Program Files (x86)Windows Kits10includewdfwinrt;C:Program Files (x86)Microsoft Visual Studio 14.0VCINCLUDE;C:Program Files (x86)Microsoft Visual Studio 14.0VCATLMFCINCLUDE;C:Program Files (x86)Windows Kits10includewdfucrt;C:Program Files (x86)Windows KitsNETFXSDK4.6includeum;C:Program Files (x86)Windows Kits10includewdfshared;C:Program Files (x86)Windows Kits10includewdfum;C:Program Files (x86)Windows Kits10includewdfwinrt;
注意环境变量中的路径是C:Program Files (x86)Windows Kits10includewdfwinrt;"等.但是,文件的实际位置是C:Program Files (x86)Windows Kits10include10.0.10240.0winrt;
Note that the paths in the environment variable are "C:Program Files (x86)Windows Kits10includewdfwinrt;" etc. However, the actual location of the files is C:Program Files (x86)Windows Kits10include10.0.10240.0winrt;
我在这里做错了吗?非常感谢任何帮助.
Am I doing something wrong here? Any help greatly appreciated.
ps.我的真正目的是构建 boost 1.58 库(但它遇到与上述相同的问题,所以首先想隔离问题).
p.p.s.我注意到以下环境变量.但我无法更改它们.
WindowsSDKLibVersion=wdf
WindowsSDKVersion=wdf
推荐答案
如果您安装了 WDK (Windows Driver Kit - 10.0.26639),您将遇到此问题,因为 WDK 会覆盖包含路径.要使其正常工作,您必须卸载 WDK,它应该可以正常工作.
If you have WDK (Windows Driver Kit - 10.0.26639) installed you will encounter this issue as the include paths are overwritten by the WDK. To get this to work, you must uninstall the WDK and it should work.
查看 Microsoft Connect 问题 - https://connect.microsoft.com/VisualStudio/feedback/details/1610302/universalcrt-detection-breaks-when-windows-driver-kit-is-installed
Take a look at the Microsoft Connect issue - https://connect.microsoft.com/VisualStudio/feedback/details/1610302/universalcrt-detection-breaks-when-windows-driver-kit-is-installed
这篇关于VS2015 cl 在命令行上构建时找不到 CRT 库(stdio.h、ctype.h 等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!