# IntelliSense cannot resolve plugin includes in .h files (works in .cpp); raising MaxSharedIncludePaths causes MSB4018 

**URL:** <https://forums.unrealengine.com/t/intellisense-cannot-resolve-plugin-includes-in-h-files-works-in-cpp-raising-maxsharedincludepaths-causes-msb4018/2877540>\
**Category:** Issues and Bug Reporting (Unreal Engine)\
**Tags:** unreal-engine, intellisense, question\
**Created:** [December 5, 2026, 2:00pm UTC](https://forums.unrealengine.com/t/intellisense-cannot-resolve-plugin-includes-in-h-files-works-in-cpp-raising-maxsharedincludepaths-causes-msb4018/2877540 "2026-12-05T14:00:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PublicSwift7397](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PublicSwift7397](https://forums.unrealengine.com/u/PublicSwift7397)\
**Post date:** [December 5, 2026, 2:00pm UTC](https://forums.unrealengine.com/t/intellisense-cannot-resolve-plugin-includes-in-h-files-works-in-cpp-raising-maxsharedincludepaths-causes-msb4018/2877540/1 "2026-12-05T14:00:09Z")

</div>

### Summary

IntelliSense / Go To Definition (F12) cannot resolve engine and plugin  
includes in header (.h) files of a C++ project in Visual Studio 2026, while  
the same includes resolve correctly in .cpp files and the project compiles  
successfully. The generated .vcxproj only contains the required include  
directory (EnhancedInput\Public) in the per-file include directories of .cpp  
items, not in the project-level shared IncludePath. Increasing  
MaxSharedIncludePaths to work around this causes MSBuild error MSB4018  
(“environment variable name or value is too long”).

### What Type of Bug are you experiencing?

Foundation (C++ Tools, Profiling, & Pipeline)

### Steps to Reproduce

1. Open the UBT-generated AdventureProject.slnx in Visual Studio 2026. Select DebugGame Editor | Win64.
2. Confirm that AdventureProject.Build.cs lists EnhancedInput in PublicDependencyModuleNames and that the project builds successfully.
3. In Solution Explorer, open AdventureCharacter.h. Place the cursor on EnhancedInputComponent.h in #include “EnhancedInputComponent.h” and press F12.
4. For comparison, temporarily add the same include to AdventureCharacter.cpp and press F12 on the header name there.  
Expected: Both locations open EnhancedInputComponent.h.

Actual: Visual Studio reports that it cannot find the header when navigating from AdventureCharacter.h. The same include opens the header successfully from AdventureCharacter.cpp.

### Expected Result

Pressing F12 on #include “EnhancedInputComponent.h” should open EnhancedInputComponent.h from both AdventureCharacter.h and AdventureCharacter.cpp in the generated Visual Studio project.

### Observed Result

Pressing F12 on `#include "EnhancedInputComponent.h"` in `AdventureCharacter.h` fails. Visual Studio reports that it cannot find the header. The same include resolves correctly with F12 from `AdventureCharacter.cpp`. The project builds successfully.

### Affects Versions

5.8

### Platform(s)

Windows

### Upload an image

 ![微信图片_20261205132047_61_26.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/e/94ef175e9826a750374de18da38830750a231eee.png)

### Additional Notes

Project: AdventureProject (created from the First Person Blueprint template,  
then converted to C++ by adding a C++ module).

The module “EnhancedInput” is listed in PublicDependencyModuleNames of  
AdventureProject.Build.cs. The project compiles successfully.

The same include line behaves differently depending on the file type:

```
#include "EnhancedInputComponent.h"

```

- In a .cpp file: IntelliSense resolves it and F12 opens the header.
- In a .h file (AdventureCharacter.h, line 6): IntelliSense reports  
E1696 “cannot open source file” and F12 fails.

In the same header, IntelliSense also reports E1696 for:

- InputActionValue.h
- EnhancedInputSubsystems.h

F12 failing on “GameFramework/Character.h” from a header was also observed  
earlier, but has not been re-verified in the same test session.

Verified finding in the generated project file  
(Intermediate\ProjectFiles\AdventureProject.vcxproj):

- The EnhancedInput\Public directory IS present in the per-file include  
directories of .cpp items.
- The EnhancedInput\Public directory is NOT present in the project-level  
shared IncludePath.

This suggests that header files only get the shared IncludePath for  
IntelliSense, so any include directory that does not fit into the shared  
list (limited by VCProjectFileGenerator.MaxSharedIncludePaths) cannot be  
resolved from headers. Which include path set Visual Studio actually uses  
when resolving F12 from a .h file has not been confirmed.

Attempted workaround: increasing MaxSharedIncludePaths in  
BuildConfiguration.xml (tested with 49512) so that more directories fit into  
the shared IncludePath. After regenerating project files, building from  
Visual Studio fails, since the INCLUDE environment variable exceeds the  
Windows limit of 32767 characters:

```
1>------ Build started: Project: AdventureProject,
     Configuration: Development_Editor x64 ------
1>C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\
  Microsoft\VC\v180\Microsoft.Cpp.Current.targets(102,5):
  error MSB4018: The "SetEnv" task failed unexpectedly.
System.ArgumentException: Environment variable name or value is too long.
   at System.Environment.SetEnvironmentVariable(String variable,
      String value)
   at System.Environment.SetEnvironmentVariable(String variable,
      String value, EnvironmentVariableTarget target)
   at Microsoft.Build.CPPTasks.SetEnv.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>
      d__26.MoveNext()

```

The override has since been removed (MaxSharedIncludePaths back to default),  
and the build works again, but the header IntelliSense issue remains.

As a result, there is currently no configuration within Visual Studio’s  
built-in IntelliSense that resolves these engine/plugin includes in header  
files without hitting the MSBuild environment variable limit. The long  
default install path of the Launcher engine  
(C:\Program Files\Epic Games\UE\_5.8) and the long default project location  
(C:\Users\<user\>\Documents\Unreal Projects...) likely reduce how many  
directories fit into the shared IncludePath.  
[Workarounds Tried]

- Regenerating project files: no effect.
- Clearing the .vs folder / \*.VC.db: no effect.
- Moving the includes into the .cpp file and using forward declarations in  
the header: avoids the issue, but is not always desirable.
- Not tested yet: Visual Studio 2022 (not installed on this machine),  
shorter engine/project install paths, Rider or Visual Assist.  
[Suggestion]  
Consider providing include paths to IntelliSense for header files in a way  
that does not depend on the length of the INCLUDE environment variable  
(for example, associating header items with the include directories of their  
module), or documenting a recommended configuration for projects with many  
include paths.

[Environment]

- Unreal Engine: 5.8.4 (Changelist 58902052, ++UE5+Release-5.8),  
Epic Games Launcher installed build
- Engine install path: C:\Program Files\Epic Games\UE\_5.8
- Project path: C:\Users\<user\>\Documents\Unreal Projects\AdventureProject
- Project template: First Person Blueprint template, converted to C++
- Visual Studio: Visual Studio Community 2026, 18.12.12412.261 (Stable)
- MSVC toolset: v145 / 14.50.35717
- Windows SDK: 10.0.26100.0 (as referenced by the generated VS project)
- Visual Studio Integration Tool: 2.8
- Build configurations used: DebugGame Editor Win64 (reproduction),  
Development Editor Win64 (MSB4018 error log)
- OS: Windows 11 26H2 x64, OS Build 26300.9974
- CPU: Intel Core i7-12700H (14 cores / 20 threads)
- RAM: 16 GB (15.69 GiB usable)

[Build.cs]  
using UnrealBuildTool;

public class AdventureProject : ModuleRules  
{  
public AdventureProject(ReadOnlyTargetRules Target) : base(Target)  
{  
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

```
    PublicDependencyModuleNames.AddRange(new string[] { "Core",
        "CoreUObject", "Engine", "InputCore", "EnhancedInput" });

    PrivateDependencyModuleNames.AddRange(new string[] { });
}

```

}

[BuildConfiguration.xml (current, user-level and project-level identical)]

\<?xml version="1.0" encoding="utf-8" ?\>

[Attachments]

- Screenshot: E1696 errors in AdventureCharacter.h
- Screenshot: F12 working in .cpp vs failing in .h for the same include
- Screenshot: MSB4018 build error
- Excerpt of AdventureProject.vcxproj showing EnhancedInput\Public in the  
.cpp per-file include directories but not in the shared IncludePath  
==================================================  
I used an AI assistant to help investigate this issue and tried several approaches, including regenerating the Visual Studio project files, rebuilding the IntelliSense cache, and verifying that the project builds successfully.

Comparing F12 navigation from AdventureCharacter.h and AdventureCharacter.cpp revealed a difference in the generated project file. EnhancedInput\Public is present in the .cpp file’s include directories and absent from the project-wide IncludePath. This is consistent with the behavior I observed. I could not confirm which search paths Visual Studio actually uses when F12 is invoked from the .h file.

I encountered this while following the official Unreal Engine tutorial. As a beginner, I found it difficult to understand why Visual Studio reported a missing header when the project compiled successfully. I hope Epic can investigate and improve the default Visual Studio experience for users following the tutorial.

This report was drafted with AI assistance to summarize my troubleshooting steps, observations, and reasoning.
