Visual Studio 2017 errors on standard headers

后端 未结 5 1108
一向
一向 2020-11-30 02:37

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:

相关标签:
5条回答
  • 2020-11-30 03:22

    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:

    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.

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

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

    0 讨论(0)
  • 2020-11-30 03:24

    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.

    0 讨论(0)
  • 2020-11-30 03:34

    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.  

    0 讨论(0)
  • 2020-11-30 03:37

    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.

    0 讨论(0)
  • 2020-11-30 03:42

    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

    0 讨论(0)
提交回复
热议问题