VS2015 cl Can#39;t find CRT libs (stdio.h, ctype.h etc.) when building on command line(VS2015 cl 在命令行上构建时找不到 CRT 库(stdio.h、ctype.h 等))
问题描述
- 我已经安装了最新的 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 等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:VS2015 cl 在命令行上构建时找不到 CRT 库(stdio.h、ctype.h 等)


基础教程推荐
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 常量变量在标题中不起作用 2021-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30