[c++] Visual Studio 2017 errors on standard headers

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:

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 Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cerrno  7   
Error (active)  E1696   cannot open source file "float.h"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cfloat  7   
Error (active)  E0282   the global scope has no "acosf" RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath   629 
Error (active)  E0282   the global scope has no "asinf" RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath   629 
Error (active)  E0282   the global scope has no "atanf" RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath   630 
Error (active)  E0282   the global scope has no "atan2f"    RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath   630 
Error (active)  E0282   the global scope has no "ceilf" RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath   630 
Error (active)  E0282   the global scope has no "cosf"  RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath   631 
Error (active)  E0282   the global scope has no "coshf" RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath   631 
Error (active)  E0282   the global scope has no "swprintf"  RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  21  
Error (active)  E0282   the global scope has no "swscanf"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  21  
Error (active)  E0282   the global scope has no "ungetwc"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  21  
Error (active)  E0282   the global scope has no "vfwprintf" RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  22  
Error (active)  E0282   the global scope has no "vswprintf" RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  22  
Error (active)  E0282   the global scope has no "vwprintf"  RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  22  
Error (active)  E0282   the global scope has no "wcrtomb"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  23  
Error (active)  E0282   the global scope has no "wprintf"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  23  
Error (active)  E0282   the global scope has no "wscanf"    RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  23  
Error (active)  E0282   the global scope has no "wcsrtombs" RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  24  
Error (active)  E0282   the global scope has no "wcstol"    RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  24  
Error (active)  E0282   the global scope has no "wcscat"    RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  24  
Error (active)  E0282   the global scope has no "wcschr"    RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  25  
Error (active)  E0282   the global scope has no "wcscmp"    RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  25  
Error (active)  E0282   the global scope has no "wcscoll"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  25  
Error (active)  E0282   the global scope has no "wcscpy"    RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  26  
Error (active)  E0282   the global scope has no "wcscspn"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  26  
Error (active)  E0282   the global scope has no "wcslen"    RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  26  
Error (active)  E0282   the global scope has no "wcsncat"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  27  
Error (active)  E0282   the global scope has no "wcsncmp"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  27  
Error (active)  E0282   the global scope has no "wcsncpy"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  27  
Error (active)  E0282   the global scope has no "wcspbrk"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cwchar  28  
Error (active)  E0282   the global scope has no "wcsrchr"   RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools
Error (active)  E0260   explicit type is missing ('int' assumed)    RPGWorld    c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.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 studio\2017\community\vc\tools\msvc\14.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 studio\2017\community\vc\tools\msvc\14.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 studio\2017\community\vc\tools\msvc\14.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 studio\2017\community\vc\tools\msvc\14.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 studio\2017\community\vc\tools\msvc\14.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 studio\2017\community\vc\tools\msvc\14.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 studio\2017\community\vc\tools\msvc\14.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 studio\2017\community\vc\tools\msvc\14.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!

This question is related to c++ visual-studio visual-studio-2017

The answer is


This problem may also happen if you have a unit test project that has a different C++ version than the project you want to test.

Example:

  • EXE with C++ 17 enabled explicitly
  • Unit Test with C++ version set to "Default"

Solution: change the Unit Test to C++17 as well.

Screenshot


If the problem is not solved by above answer, check whether the Windows SDK version is 10.0.15063.0.

Project -> Properties -> General -> Windows SDK Version -> select 10.0.15063.0

After this rebuild the solution.  


I upgraded VS2017 from version 15.2 to 15.8. With version 15.8 here's what happened:

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.

I would have submitted this as a comment on one of the other answers but I don't have enough reputation yet.


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.

To retarget solution: Project->Retarget Solution->"Select whichever SDK you have installed"->OK

From there on you can simply build/debug your solution. Hope it helps

enter image description here


Examples related to c++

Method Call Chaining; returning a pointer vs a reference? How can I tell if an algorithm is efficient? Difference between opening a file in binary vs text How can compare-and-swap be used for a wait-free mutual exclusion for any shared data structure? Install Qt on Ubuntu #include errors detected in vscode Cannot open include file: 'stdio.h' - Visual Studio Community 2017 - C++ Error How to fix the error "Windows SDK version 8.1" was not found? Visual Studio 2017 errors on standard headers How do I check if a Key is pressed on C++

Examples related to visual-studio

VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio? How to download Visual Studio Community Edition 2015 (not 2017) Cannot open include file: 'stdio.h' - Visual Studio Community 2017 - C++ Error How to fix the error "Windows SDK version 8.1" was not found? Visual Studio Code pylint: Unable to import 'protorpc' Open the terminal in visual studio? Is Visual Studio Community a 30 day trial? How can I run NUnit tests in Visual Studio 2017? Visual Studio 2017: Display method references

Examples related to visual-studio-2017

Assets file project.assets.json not found. Run a NuGet package restore How to remove an unpushed outgoing commit in Visual Studio? The current .NET SDK does not support targeting .NET Standard 2.0 error in Visual Studio 2017 update 15.3 Create Setup/MSI installer in Visual Studio 2017 VS 2017 Metadata file '.dll could not be found Cannot open include file: 'stdio.h' - Visual Studio Community 2017 - C++ Error Visual Studio 2017 does not have Business Intelligence Integration Services/Projects How can I run NUnit tests in Visual Studio 2017? How to integrate SAP Crystal Reports in Visual Studio 2017 Unit Tests not discovered in Visual Studio 2017