C++ 标准标头上的 Visual Studio 2017 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42777424/
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
Visual Studio 2017 errors on standard headers
提问by o.o
I just upgraded to Visual Studio 2017 Community Edition and I have trouble loading standard header files. I get 507 errors from various header files. Here are some snippets:
我刚刚升级到 Visual Studio 2017 社区版,但在加载标准头文件时遇到了问题。我从各种头文件中得到 507 错误。以下是一些片段:
Some of the errors:
一些错误:
Severity Code Description Project File Line Suppression State
Error (active) E1696 cannot open source file "errno.h" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cerrno 7
Error (active) E1696 cannot open source file "float.h" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cfloat 7
Error (active) E0282 the global scope has no "acosf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cmath 629
Error (active) E0282 the global scope has no "asinf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cmath 629
Error (active) E0282 the global scope has no "atanf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cmath 630
Error (active) E0282 the global scope has no "atan2f" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cmath 630
Error (active) E0282 the global scope has no "ceilf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cmath 630
Error (active) E0282 the global scope has no "cosf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cmath 631
Error (active) E0282 the global scope has no "coshf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cmath 631
Error (active) E0282 the global scope has no "swprintf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 21
Error (active) E0282 the global scope has no "swscanf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 21
Error (active) E0282 the global scope has no "ungetwc" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 21
Error (active) E0282 the global scope has no "vfwprintf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 22
Error (active) E0282 the global scope has no "vswprintf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 22
Error (active) E0282 the global scope has no "vwprintf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 22
Error (active) E0282 the global scope has no "wcrtomb" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 23
Error (active) E0282 the global scope has no "wprintf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 23
Error (active) E0282 the global scope has no "wscanf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 23
Error (active) E0282 the global scope has no "wcsrtombs" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 24
Error (active) E0282 the global scope has no "wcstol" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 24
Error (active) E0282 the global scope has no "wcscat" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 24
Error (active) E0282 the global scope has no "wcschr" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 25
Error (active) E0282 the global scope has no "wcscmp" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 25
Error (active) E0282 the global scope has no "wcscoll" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 25
Error (active) E0282 the global scope has no "wcscpy" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 26
Error (active) E0282 the global scope has no "wcscspn" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 26
Error (active) E0282 the global scope has no "wcslen" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 26
Error (active) E0282 the global scope has no "wcsncat" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 27
Error (active) E0282 the global scope has no "wcsncmp" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 27
Error (active) E0282 the global scope has no "wcsncpy" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 27
Error (active) E0282 the global scope has no "wcspbrk" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\cwchar 28
Error (active) E0282 the global scope has no "wcsrchr" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools
Error (active) E0260 explicit type is missing ('int' assumed) RPGWorld c:\Program Files (x86)\Microsoft Visual Studio17\Community\VC\Tools\MSVC.10.25017\include\xtgmath.h 212
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\Graphics\Glsl.inl 40
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\Graphics\Texture.hpp 159
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\Graphics\VertexArray.hpp 64
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\Graphics\VertexArray.hpp 72
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\Graphics\VertexArray.hpp 88
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\Graphics\VertexArray.hpp 104
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\Graphics\VertexArray.hpp 129
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 58
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 332
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 345
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 365
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 387
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 387
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 399
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 413
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 413
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 427
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 427
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 456
Error (active) E0757 variable "size_t" is not a type name RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\packages\sfml-system.2.4.0.0\build\native\include\SFML\System\String.hpp 456
Error (active) E0020 identifier "rand" is undefined RPGWorld c:\Users\Fazil\Documents\Visual Studio 2017\Projects\Local\RPGWorld\RPGWorld\Blocks.cpp 23
Error C1083 Cannot open include file: 'corecrt.h': No such file or directory RPGWorld c:\program files (x86)\microsoft visual studio17\community\vc\tools\msvc.10.25017\include\crtdefs.h 10
Error C1083 Cannot open include file: 'corecrt.h': No such file or directory RPGWorld c:\program files (x86)\microsoft visual studio17\community\vc\tools\msvc.10.25017\include\crtdefs.h 10
Error C1083 Cannot open include file: 'corecrt.h': No such file or directory RPGWorld c:\program files (x86)\microsoft visual studio17\community\vc\tools\msvc.10.25017\include\crtdefs.h 10
Error C1083 Cannot open include file: 'corecrt.h': No such file or directory RPGWorld c:\program files (x86)\microsoft visual studio17\community\vc\tools\msvc.10.25017\include\crtdefs.h 10
Error C1083 Cannot open include file: 'corecrt.h': No such file or directory RPGWorld c:\program files (x86)\microsoft visual studio17\community\vc\tools\msvc.10.25017\include\crtdefs.h 10
Error C1083 Cannot open include file: 'corecrt.h': No such file or directory RPGWorld c:\program files (x86)\microsoft visual studio17\community\vc\tools\msvc.10.25017\include\crtdefs.h 10
Error C1083 Cannot open include file: 'corecrt.h': No such file or directory RPGWorld c:\program files (x86)\microsoft visual studio17\community\vc\tools\msvc.10.25017\include\crtdefs.h 10
Error C1083 Cannot open include file: 'corecrt.h': No such file or directory RPGWorld c:\program files (x86)\microsoft visual studio17\community\vc\tools\msvc.10.25017\include\crtdefs.h 10
I never had this issue with Visual Studio 2015 Community Edition. Am I missing some component from the Installer? Any help would be appreciated. Thank you!
我在 Visual Studio 2015 社区版中从未遇到过这个问题。我是否缺少安装程序中的某些组件?任何帮助,将不胜感激。谢谢!
回答by o.o
I got the errors to go away by installing the Windows Universal CRT SDK
component, which adds support for legacy Windows SDKs. You can install this using the Visual Studio Installer:
我通过安装该Windows Universal CRT SDK
组件消除了错误,这增加了对旧版 Windows SDK 的支持。您可以使用 Visual Studio 安装程序安装它:
If the problem still persists, you should change the Target SDK in the Visual Studio Project : check whether the Windows SDK version is 10.0.15063.0.
如果问题仍然存在,则应更改Visual Studio Project 中的Target SDK:检查Windows SDK 版本是否为10.0.15063.0。
In : Project -> Properties -> General -> Windows SDK Version -> select 10.0.15063.0.
在:项目 -> 属性 -> 常规 -> Windows SDK 版本 -> 选择 10.0.15063.0。
Then errno.h and other standard files will be found and it will compile.
然后将找到 errno.h 和其他标准文件并进行编译。
回答by azhar baloch
If the problem is not solved by above answer, check whether the Windows SDK version is 10.0.15063.0.
如果上面的回答没有解决问题,请检查Windows SDK版本是否为10.0.15063.0。
Project -> Properties -> General -> Windows SDK Version -> select 10.0.15063.0
项目 -> 属性 -> 常规 -> Windows SDK 版本 -> 选择 10.0.15063.0
After this rebuild the solution.
在此之后重建解决方案。
回答by echo
I upgraded VS2017 from version 15.2 to 15.8. With version 15.8 here's what happened:
我将 VS2017 从 15.2 版升级到 15.8 版。在 15.8 版中,发生了以下情况:
Project -> Properties -> General -> Windows SDK Version -> select 10.0.15063.0 no longer worked for me! I had to change it to 10.0.17134.0 and then everything built again. After the upgrade and without making this change, I was getting the same header file errors.
项目 -> 属性 -> 常规 -> Windows SDK 版本 -> 选择 10.0.15063.0 不再适合我!我不得不将其更改为 10.0.17134.0,然后重新构建所有内容。升级后没有进行此更改,我收到了相同的头文件错误。
I would have submitted this as a comment on one of the other answers but I don't have enough reputation yet.
我会提交这个作为对其他答案之一的评论,但我还没有足够的声誉。
回答by Rafay Khan
If anyone's still stuck on this, the easiest solution I found was to "Retarget Solution". In my case, the project was built of SDK 8.1, upgrading to VS2017 brought with it SDK 10.0.xxx.
如果有人仍然坚持这一点,我找到的最简单的解决方案是“重新定位解决方案”。就我而言,该项目是由 SDK 8.1 构建的,升级到 VS2017 带来了 SDK 10.0.xxx。
To retarget solution: Project->Retarget Solution->"Select whichever SDK you have installed"->OK
重定向解决方案:项目->重定向解决方案->“选择您安装的任何SDK”->确定
From there on you can simply build/debug your solution. Hope it helps
从那时起,您可以简单地构建/调试您的解决方案。希望能帮助到你