VS2015 cl在命令行上构建时找不到CRT库(stdio.h,ctype.h等) [英] VS2015 cl Can't find CRT libs (stdio.h, ctype.h etc.) when building on command line

查看:186
本文介绍了VS2015 cl在命令行上构建时找不到CRT库(stdio.h,ctype.h等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 我已经安装了最新的VS2015 Professional版本。

  • 打开Visual Studio命令提示符并运行vcvars32.bat

  • 编写了一个简单的helloworld.cpp程序(包括stdio.h并显示 hello world)

  • 尝试了 cl helloworld.cpp

  • I have installed the latest VS2015 Professional version.
  • Opened the Visual Studio command prompt and ran vcvars32.bat
  • wrote a simple helloworld.cpp program (includes stdio.h and prints "hello world")
  • tried cl helloworld.cpp

我收到以下错误:

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设置的包含路径为:

The include paths set by the vcvars32.bat are:

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套件\10\包括\ wdf \winrt; 等。但是,文件的实际位置是 C:\Program Files (x86)\Windows套件\10\include\ 10.0.10240.0 \winrt;

Note that the paths in the environment variable are "C:\Program Files (x86)\Windows Kits\10\include\wdf\winrt;" etc. However, the actual location of the files is C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt;

我在这里做错了什么?

Am I doing something wrong here? Any help greatly appreciated.

p.s。我的真正目的是构建boost 1.58库(但是它遇到与上述相同的问题,因此首先想找出问题所在。)

pps我注意到以下环境变量。但是我无法更改它们。

WindowsSDKLibVersion=wdf\
WindowsSDKVersion=wdf\


推荐答案

如果您有WDK(Windows驱动程序工具包-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/安装了Windows驱动程序工具包时,universalcrt-detection-breakings

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等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆