You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio 2017更新后无法打开sys/types.h等头文件求助

Fixing "Cannot open source file sys/types.h" and "sys/stat.h" Errors in Visual Studio 2017

Hey there, let's work through this frustrating issue you're facing after updating Visual Studio 2017. Those sys/types.h and sys/stat.h missing errors popping up in wchar.h (error code E1969) aren't standard for Windows VS setups, so let's walk through targeted fixes:

  • Verify Project SDK and Toolset Configuration
    Right-click your project → Properties, then head to Configuration Properties > General.

    • Confirm the Windows SDK Version is set to a version you have installed (VS2017 typically works best with SDKs like 10.0.17763.0 or older compatible releases).
    • Double-check the Platform Toolset is set to v141 (the official toolset for VS2017)—updates sometimes accidentally switch this to a newer/uninstalled version.
  • Repair Visual Studio Installation
    Open the Visual Studio Installer, find your VS2017 instance, and click Modify.

    • Ensure the required Windows SDK component (matching your project's configured version) is checked.
    • Make sure all core C++ development tools are enabled, then select the Repair option to fix any corrupted or missing system files.
  • Clean Up Include Directory Priorities
    Go to Project Properties → Configuration Properties > C/C++ > General and look at the Additional Include Directories.

    • Remove any Unix-style include paths (like those pointing to directories with sys/ subfolders) that might be overriding VS's default system header lookup.
    • Save changes and try recompiling.
  • Clear Project Build Cache

    • Delete the Debug and Release folders in your project directory manually.
    • In Solution Explorer, right-click your solution → Clean Solution, then right-click again → Rebuild Solution. This ensures no stale or corrupted build files are causing issues.
  • Check for Corrupted wchar.h File
    The errors are originating in wchar.h, so it's possible this system header got modified or corrupted during the update.

    • Navigate to your VS2017 include directory (usually C:\Program Files (x86)\Microsoft Visual Studio\2017\<Edition>\VC\Tools\MSVC\<version>\include).
    • Compare your wchar.h with a fresh copy from a working VS2017 installation, or replace it with a clean version if you have one—this can resolve unexpected references to Unix-style headers.

A quick note: sys/types.h and sys/stat.h are Unix/Linux standard headers, so VS's Windows-focused standard library shouldn't be referencing them by default. This issue almost always ties back to misconfiguration, corrupted installation files, or accidental header modifications.

内容的提问来源于stack exchange,提问作者Silviu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:58:13