标准标题上的 Visual Studio 2017 错误

2022-01-11 00:00:00 visual-studio visual-studio-2017 c++

我刚刚升级到 Visual Studio 2017 社区版,但无法加载标准头文件.我从各种头文件中得到 507 错误.以下是一些片段:

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:

一些错误:

Severity    Code    Description Project File    Line    Suppression State
Error (active)  E1696   cannot open source file "errno.h"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecerrno  7   
Error (active)  E1696   cannot open source file "float.h"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecfloat  7   
Error (active)  E0282   the global scope has no "acosf" RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecmath   629 
Error (active)  E0282   the global scope has no "asinf" RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecmath   629 
Error (active)  E0282   the global scope has no "atanf" RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecmath   630 
Error (active)  E0282   the global scope has no "atan2f"    RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecmath   630 
Error (active)  E0282   the global scope has no "ceilf" RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecmath   630 
Error (active)  E0282   the global scope has no "cosf"  RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecmath   631 
Error (active)  E0282   the global scope has no "coshf" RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecmath   631 
Error (active)  E0282   the global scope has no "swprintf"  RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  21  
Error (active)  E0282   the global scope has no "swscanf"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  21  
Error (active)  E0282   the global scope has no "ungetwc"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  21  
Error (active)  E0282   the global scope has no "vfwprintf" RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  22  
Error (active)  E0282   the global scope has no "vswprintf" RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  22  
Error (active)  E0282   the global scope has no "vwprintf"  RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  22  
Error (active)  E0282   the global scope has no "wcrtomb"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  23  
Error (active)  E0282   the global scope has no "wprintf"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  23  
Error (active)  E0282   the global scope has no "wscanf"    RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  23  
Error (active)  E0282   the global scope has no "wcsrtombs" RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  24  
Error (active)  E0282   the global scope has no "wcstol"    RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  24  
Error (active)  E0282   the global scope has no "wcscat"    RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  24  
Error (active)  E0282   the global scope has no "wcschr"    RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  25  
Error (active)  E0282   the global scope has no "wcscmp"    RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  25  
Error (active)  E0282   the global scope has no "wcscoll"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  25  
Error (active)  E0282   the global scope has no "wcscpy"    RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  26  
Error (active)  E0282   the global scope has no "wcscspn"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  26  
Error (active)  E0282   the global scope has no "wcslen"    RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  26  
Error (active)  E0282   the global scope has no "wcsncat"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  27  
Error (active)  E0282   the global scope has no "wcsncmp"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  27  
Error (active)  E0282   the global scope has no "wcsncpy"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  27  
Error (active)  E0282   the global scope has no "wcspbrk"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includecwchar  28  
Error (active)  E0282   the global scope has no "wcsrchr"   RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCTools
Error (active)  E0260   explicit type is missing ('int' assumed)    RPGWorld    c:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.10.25017includextgmath.h   212 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLGraphicsGlsl.inl    40  
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLGraphicsTexture.hpp 159 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLGraphicsVertexArray.hpp 64  
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLGraphicsVertexArray.hpp 72  
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLGraphicsVertexArray.hpp 88  
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLGraphicsVertexArray.hpp 104 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLGraphicsVertexArray.hpp 129 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    58  
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    332 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    345 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    365 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    387 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    387 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    399 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    413 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    413 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    427 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    427 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    456 
Error (active)  E0757   variable "size_t" is not a type name    RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldpackagessfml-system.2.4.0.0uild
ativeincludeSFMLSystemString.hpp    456 
Error (active)  E0020   identifier "rand" is undefined  RPGWorld    c:UsersFazilDocumentsVisual Studio 2017ProjectsLocalRPGWorldRPGWorldBlocks.cpp 23  
Error   C1083   Cannot open include file: 'corecrt.h': No such file or directory    RPGWorld    c:program files (x86)microsoft visual studio2017communityvc	oolsmsvc14.10.25017includecrtdefs.h   10  
Error   C1083   Cannot open include file: 'corecrt.h': No such file or directory    RPGWorld    c:program files (x86)microsoft visual studio2017communityvc	oolsmsvc14.10.25017includecrtdefs.h   10  
Error   C1083   Cannot open include file: 'corecrt.h': No such file or directory    RPGWorld    c:program files (x86)microsoft visual studio2017communityvc	oolsmsvc14.10.25017includecrtdefs.h   10  
Error   C1083   Cannot open include file: 'corecrt.h': No such file or directory    RPGWorld    c:program files (x86)microsoft visual studio2017communityvc	oolsmsvc14.10.25017includecrtdefs.h   10  
Error   C1083   Cannot open include file: 'corecrt.h': No such file or directory    RPGWorld    c:program files (x86)microsoft visual studio2017communityvc	oolsmsvc14.10.25017includecrtdefs.h   10  
Error   C1083   Cannot open include file: 'corecrt.h': No such file or directory    RPGWorld    c:program files (x86)microsoft visual studio2017communityvc	oolsmsvc14.10.25017includecrtdefs.h   10  
Error   C1083   Cannot open include file: 'corecrt.h': No such file or directory    RPGWorld    c:program files (x86)microsoft visual studio2017communityvc	oolsmsvc14.10.25017includecrtdefs.h   10  
Error   C1083   Cannot open include file: 'corecrt.h': No such file or directory    RPGWorld    c:program files (x86)microsoft visual studio2017communityvc	oolsmsvc14.10.25017includecrtdefs.h   10  

我在使用 Visual Studio 2015 社区版时从未遇到过这个问题.我是否缺少安装程序中的某些组件?任何帮助,将不胜感激.谢谢!

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!

推荐答案

我通过安装 Windows Universal CRT SDK 组件消除了错误,该组件增加了对旧版 Windows SDK 的支持.您可以使用 Visual Studio 安装程序安装它:

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:

如果问题仍然存在,则应在 Visual Studio 项目中更改 Target SDK:检查 Windows SDK 版本是否为 10.0.15063.0.

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.

在:项目 -> 属性 -> 常规 -> Windows SDK 版本 -> 选择 10.0.15063.0.

In : Project -> Properties -> General -> Windows SDK Version -> select 10.0.15063.0.

然后会找到errno.h等标准文件并编译.

Then errno.h and other standard files will be found and it will compile.

相关文章