The creation wizard is not correctly adding the #include path in the CPP file. To fix the issue to get the project to compile you have to add the path in the .CPP file within Visual Studio. In this case change #include "MyCharacter.h" to #include "Characters/MyCharacter.h"

This is required for all new classes. Workaround is not to use the Public/Private folder structure when creating the class and there is no issue.

This was reported and tested in 4.24.3 (CL-11590370). This was reproduced in 4.25 (CL-13144385) and Main 4.26 (CL-13230104)

Steps to Reproduce
  1. Open the UE4 Editor and create a Blank C++ project
  2. Create a new C++ Class, any class will work
  3. In the Path add a sub-directory. For example if it has this by default "Unreal/Code24/Source/Code24/" then do this "Unreal/Code24/Source/Code24/Extra"
  4. Set the class to Public and create class

Results: Code fails to compile with the created .h file of you class. "fatal error C1083: Cannot open include file: 'MyCharacter.h': No such file or directory"

Expected: Successful compilation

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-92876 in the post.

Login to Vote

Won't Fix
Affects Versions4.
CreatedMay 7, 2020
ResolvedAug 31, 2021
UpdatedAug 31, 2021
View Jira Issue