Share via

Help with Visual Studio Compilation Errors on Windows 10 PLEASE

Anonymous
2025-06-19T22:45:47+00:00

(Primarily I speak Russian, but this message will be in English)

Hello Support Team,

I am a Windows user facing an issue with Visual Studio while trying to compile a project. I’ve been struggling with errors related to missing header files for almost 2 months now, and I desperately need your help to resolve this. I need to compile a .dll file, and this problem is holding me back. Below are the details of my setup and the problem.

  1. Additional Include Paths: I have 4 paths configured in my project, and here they are:
    • B:\Windows Kits\10\Include\10.0.26100.0\um
    • B:\Windows Kits\10\Include\10.0.26100.0\ucrt
    • MyProjectPath\include
    • $(VC_IncludePath) These paths are supposed to help the compiler find files like Windows.h, WinUser.h, gl/GL.h, and gl/GLU.h, but it still fails with "cannot open source file" errors (E1696).
  2. Windows Version: I am using Windows 10.
  3. Windows SDK Version: The project is set to use Windows 11 SDK version 10.0.26100.0, as specified in the project properties.

I’ve followed various steps to fix this (cleaning the solution, updating the .vcxproj file, and ensuring the SDK is installed), but the errors persist. Please, I urgently need your assistance to resolve this issue so I can compile my .dll. Any help would be greatly appreciated!

Thank you,

Windows for home | Windows 10 | Settings

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

9 answers

Sort by: Most helpful
  1. Anonymous
    2025-06-20T16:02:05+00:00

    Thank you for the detailed follow-up you’ve done a thorough job so far, and I completely understand how discouraging this kind of error can be, especially after trying everything you've listed. Let's now move to some more advanced and targeted troubleshooting that might help finally resolve the issue with header files like Windows.h not being recognized by Visual Studio.
    Let’s Narrow Down the Root Cause

    1. Confirm Project Type and Language Settings
      If you're working on a C++ DLL, make sure:
      -Your project is not accidentally set to C or using C89/ANSI mode this can sometimes suppress Windows headers.
      Check this in:
      Project > Properties > C/C++ > Advanced > Compile As → Set to Compile as C++ (/TP)
    2. Force Use of Windows SDK in Property Pages
      Sometimes the SDK isn’t inherited properly. Do this:
      Go to:
      Project > Properties > VC++ Directories > Include Directories
      Remove $(VC_IncludePath) if it’s there and instead hardcode: B:\Windows Kits\10\Include\10.0.20348.0\um B:\Windows Kits\10\Include\10.0.20348.0\ucrt B:\Windows Kits\10\Include\10.0.20348.0\shared

    Then go to:
    Project > Properties > C/C++ > General > Additional Include Directories
    Make sure the same paths are added here manually too.
    3. Create a Simple Test Project
    Try creating a blank new Visual C++ project, and add just this code:

    #include 
    

    Build it.
    -If this compiles fine, the issue is likely specific to your existing project’s configuration.
    -If it fails, there’s likely a problem with your Visual Studio setup or SDK installation.
    4. Visual Studio Include Directories Check
    Let’s confirm Visual Studio knows where to look for headers:
    -Open Developer Command Prompt for VS 2022
    -Run this command:

    cl /E /nologo test.cpp
    

    This will show if Windows.h is being found or not.
    5. Use Environment Variable Diagnostics
    Run this in Command Prompt (not PowerShell):

    set INCLUDE
    

    Ensure it outputs lines like:

    INCLUDE=B:\Windows Kits\10\Include\10.0.20348.0\um;...
    

    If not, Visual Studio might not be passing the include paths to the compiler.
    6. Manually Check .vcxproj File
    Open your project’s .vcxproj in a text editor.
    Look for something like:

    And ensure this node exists and isn’t overridden by some broken user macros or conditionals.

    1. Still Stuck? Try Repairing VS
      If even the test project fails:
      -Open Visual Studio Installer
      -Click on your VS 2022 install → More → Repair

    You’re clearly experienced and methodical and you've narrowed this down well. If this still doesn’t work, I’d be happy to walk you through doing a clean rebuild of the .vcxproj from scratch (sometimes the configuration gets corrupted).

    Let me know the result of the test project. That’s the fastest way to find out if this is a setup problem or a project config problem.

    You're very close and I’ll stay with you on this until it’s fixed.

    Warm regards,
    Cherrelyn

    (Primarily I speak Russian, but this message will be in English)

    Hello Cherrelyn,

    Thank you so much for still trying to help me, and thank you for the kind words about my efforts! I really appreciate it. However, I’ve tried your suggestions, and the issue persists. Here’s what I did and the results:

    1. I tried setting the language to Compile as C++ (/TP) — the error is still there.
    2. I added the paths you suggested to Project > Properties > VC++ Directories > Include Directories and C/C++ > General > Additional Include Directories, and I also removed $(VC_IncludePath) as you advised, but the error remains.
    3. I created a new test project with just #include in test.cpp, built it, and still got the E1696 error: "cannot open source file Windows.h".
    4. I ran the command you suggested: cl /E /nologo test.cpp in the Developer Command Prompt for VS 2022. The output was:
      test.cpp
      #line 1 "test.cpp"
      PS MyProjectNew>
      I followed your instructions exactly: created test.cpp in the new project under Source Files with #include , and this was the result.
    5. I checked set INCLUDE in the Command Prompt, and it said: "Environment variable INCLUDE not defined". Then I manually set it with:
      set INCLUDE=B:\Windows Kits\10\Include\10.0.20348.0\um;B:\Windows Kits\10\Include\10.0.20348.0\ucrt;B:\Windows Kits\10\Include\10.0.20348.0\shared
      I rebuilt the project afterward, but the Windows.h error is still there.
    6. I checked my .vcxproj file, and the line wasn’t there. I added it manually:
      B:\Windows Kits\10\Include\10.0.20348.0\um;B:\Windows Kits\10\Include\10.0.20348.0\ucrt;B:\Windows Kits\10\Include\10.0.20348.0\shared;"MyProject"\include;$(VC_IncludePath)

    But the error still persists.

    1. Since nothing worked, I tried repairing Visual Studio via the Visual Studio Installer. It asked me to restart my computer, which I did (about 30 minutes ago), thinking it might help. After reopening Visual Studio, the problem is still there. I even opened a new test project, but the same E1696 error appears. Oh no, so much time has passed, and the issue hasn’t gone away… Please help me until this is fixed!

    Thank you,

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2025-06-20T20:16:26+00:00

    help plss

    0 comments No comments
  3. Anonymous
    2025-06-20T13:21:03+00:00

    Thank you for the detailed follow-up you’ve done a thorough job so far, and I completely understand how discouraging this kind of error can be, especially after trying everything you've listed. Let's now move to some more advanced and targeted troubleshooting that might help finally resolve the issue with header files like Windows.h not being recognized by Visual Studio.

    Let’s Narrow Down the Root Cause

    1. Confirm Project Type and Language Settings

    If you're working on a C++ DLL, make sure:

    -Your project is not accidentally set to C or using C89/ANSI mode this can sometimes suppress Windows headers.

    Check this in:

    Project > Properties > C/C++ > Advanced > Compile As → Set to Compile as C++ (/TP)

    1. Force Use of Windows SDK in Property Pages

    Sometimes the SDK isn’t inherited properly. Do this:

    Go to:

    Project > Properties > VC++ Directories > Include Directories

    Remove $(VC_IncludePath) if it’s there and instead hardcode:

    B:\Windows Kits\10\Include\10.0.20348.0\um
    B:\Windows Kits\10\Include\10.0.20348.0\ucrt
    B:\Windows Kits\10\Include\10.0.20348.0\shared
    

    Then go to:

    Project > Properties > C/C++ > General > Additional Include Directories

    Make sure the same paths are added here manually too.

    1. Create a Simple Test Project

    Try creating a blank new Visual C++ project, and add just this code:

    #include <Windows.h>
    
    int main() {
        MessageBox(0, L"Hello", L"Test", 0);
        return 0;
    }
    

    Build it.

    -If this compiles fine, the issue is likely specific to your existing project’s configuration.

    -If it fails, there’s likely a problem with your Visual Studio setup or SDK installation.

    1. Visual Studio Include Directories Check

    Let’s confirm Visual Studio knows where to look for headers:

    -Open Developer Command Prompt for VS 2022

    -Run this command:

    cl /E /nologo test.cpp
    

    This will show if Windows.h is being found or not.

    1. Use Environment Variable Diagnostics

    Run this in Command Prompt (not PowerShell):

    set INCLUDE
    

    Ensure it outputs lines like:

    INCLUDE=B:\Windows Kits\10\Include\10.0.20348.0\um;...
    

    If not, Visual Studio might not be passing the include paths to the compiler.

    1. Manually Check .vcxproj File

    Open your project’s .vcxproj in a text editor.

    Look for something like:

    <WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
    

    And ensure this node exists and isn’t overridden by some broken user macros or conditionals.

    1. Still Stuck? Try Repairing VS

    If even the test project fails:

    -Open Visual Studio Installer

    -Click on your VS 2022 install → More → Repair

    You’re clearly experienced and methodical and you've narrowed this down well. If this still doesn’t work, I’d be happy to walk you through doing a clean rebuild of the .vcxproj from scratch (sometimes the configuration gets corrupted).

    Let me know the result of the test project. That’s the fastest way to find out if this is a setup problem or a project config problem.

    You're very close and I’ll stay with you on this until it’s fixed.

    Warm regards,

    Cherrelyn

    0 comments No comments
  4. Anonymous
    2025-06-20T13:12:13+00:00

    Hi, I'm Cherrelyn, an Independent Advisor. Thank you for reaching out I understand how frustrating compiler issues can be, especially when you’ve already spent months trying to fix them. Let's work through this together so you can finally compile your DLL.
    Key Suggestions to Fix E1696 (Missing Header Files)

    1. Verify SDK Installation Paths
      -Even if SDK 10.0.26100.0 is installed, Visual Studio might not detect it correctly.
      -Open Visual Studio Installer
      -Click Modify on your current installation
      -Under Individual Components, make sure:
      -"Windows 10 SDK (10.0.26100.0)"
      -"C++ CMake tools for Windows"
      -"C++ ATL/MFC"
    2. Update Include Directories
      Use $(WindowsSDK_IncludePath) instead of hardcoding long paths like B:\Windows Kits\10\Include.... Hardcoding can break if the SDK is updated.
      Example: $(WindowsSDK_IncludePath) $(VC_IncludePath) $(ProjectDir)\include

    Go to:
    Project > Properties > C/C++ > General > Additional Include Directories
    3. Set Platform Toolset Correctly
    Go to:
    Project > Properties > General > Platform Toolset
    Select: Visual Studio 2022 (v143) or the matching version to your IDE.
    4. Use a Compatible SDK Version
    Since you're on Windows 10, try switching the SDK to:

    10.0.19041.0 (or any SDK for Windows 10)
    

    Still compatible, and often more stable.
    5. Force Visual Studio to Rescan
    Sometimes IntelliSense fails even when files are present.
    -Delete .vs folder in your project directory
    -Clean + Rebuild Solution
    6. Check for Conflicting Paths
    Make sure there's no extra space or typo in paths like:

    B:\Windows Kits\10\Include\10.0.26100.0\um
    

    It should exist and contain files like Windows.h. If not the SDK may be incomplete or corrupted.

    Optional: Reinstall Windows SDK
    If the problem continues:
    -Open Settings - Apps - "Windows Software Development Kit"
    -Uninstall -Reinstall using the Visual Studio Installer or this SDK link

    If you share the exact error lines or a screenshot, I can provide more targeted advice.

    Best Regards,
    Cherrelyn

    (Primarily I speak Russian, but this message will be in English)

    Hello Cherrelyn,

    Thank you for your previous advice. I’ve tried to follow your suggestions, but the issue persists. Here’s what I’ve done and the results:

    1. I decided to install Windows 10 SDK 10.0.20348.0, set it in the project by changing the Windows SDK version to 10.0.20348.0, and rebuilt the project. Unfortunately, the errors are still there.
    2. You suggested 3 paths for Additional Include Directories, and I added them. The error didn’t go away.
    3. I verified that I have "C++ CMake tools for Windows" installed. I also noticed that "C++ MFC" was not installed, so I installed it, but the error remains.
    4. I confirmed that my Platform Toolset is Visual Studio 2022 (v143).
    5. I cleaned the solution and rebuilt it, but the error didn’t disappear.
    6. I checked the paths (e.g., B:\Windows Kits\10\Include\10.0.20348.0 and B:\Windows Kits\10\Include\10.0.20348.0\um) and ensured there are no extra characters or typos.
    7. I don’t see the point in reinstalling the SDK since I already changed it. Also, Windows.h exists at B:\Windows Kits\10\Include\10.0.20348.0\um\Windows.h.

    Unfortunately, nothing has helped so far. Please assist me further—I’m desperate to resolve this! Any additional guidance would be greatly appreciated.

    Thank you,

    (What about AnyDesk? If you agree, but also if you're an employee, I am russian.)

    0 comments No comments
  5. Anonymous
    2025-06-19T23:34:52+00:00

    Hi, I'm Cherrelyn, an Independent Advisor. Thank you for reaching out I understand how frustrating compiler issues can be, especially when you’ve already spent months trying to fix them. Let's work through this together so you can finally compile your DLL.

    Key Suggestions to Fix E1696 (Missing Header Files)

    1. Verify SDK Installation Paths

    -Even if SDK 10.0.26100.0 is installed, Visual Studio might not detect it correctly.

    -Open Visual Studio Installer

    -Click Modify on your current installation

    -Under Individual Components, make sure:

    -"Windows 10 SDK (10.0.26100.0)"

    -"C++ CMake tools for Windows"

    -"C++ ATL/MFC"

    are selected.

    1. Update Include Directories

    Use $(WindowsSDK_IncludePath) instead of hardcoding long paths like B:\Windows Kits\10\Include.... Hardcoding can break if the SDK is updated.

    Example:

    $(WindowsSDK_IncludePath)
    $(VC_IncludePath)
    $(ProjectDir)\include
    

    Go to:

    Project > Properties > C/C++ > General > Additional Include Directories

    1. Set Platform Toolset Correctly

    Go to:

    Project > Properties > General > Platform Toolset

    Select: Visual Studio 2022 (v143) or the matching version to your IDE.

    1. Use a Compatible SDK Version

    Since you're on Windows 10, try switching the SDK to:

    10.0.19041.0 (or any SDK for Windows 10)
    

    Still compatible, and often more stable.

    1. Force Visual Studio to Rescan

    Sometimes IntelliSense fails even when files are present.

    -Delete .vs folder in your project directory

    -Clean + Rebuild Solution

    1. Check for Conflicting Paths

    Make sure there's no extra space or typo in paths like:

    B:\Windows Kits\10\Include\10.0.26100.0\um
    

    It should exist and contain files like Windows.h. If not the SDK may be incomplete or corrupted.

    Optional: Reinstall Windows SDK

    If the problem continues:

    -Open Settings - Apps - "Windows Software Development Kit"

    -Uninstall -Reinstall using the Visual Studio Installer or this SDK link

    If you share the exact error lines or a screenshot, I can provide more targeted advice.

    Best Regards,

    Cherrelyn

    0 comments No comments