problem with #include files

So I went to try the “Hello slate” tutorial in UE4 today and integrate it in my project, but upon completing the code section I cant open an include file.
the errors is as follows

1>C:\Users\MyComputer\Documents\Unreal Projects\SpacePort9\Source\SpacePort9\Private\SpacePort9HUD.cpp(4): fatal error C1083: Cannot open include file: 'SpacePort9UIWidget.h': No such file or directory

but the thing is I have a file called SpacePort9UIWidget, as you can see by the picture below.
Any help would be greatly appreciated.

Your header file resides in the Public folder, while your cpp resides in the Private folder, that’s why it can’t find your header: It’s in another directory. Change your include to

#include "../Public/SpacePort9UIWidget.h"

and it should work. Hope this helps! :slight_smile:

I tried you solution but it doesn’t seem to work

Yeah, apparently, you don’t need to use the relative path as the build tool automatically includes the Public folder (see here).

Alas, I don’t know what the problem is. Is the file really there in your file explorer? I moved a file in the Visual Studio project, but it did not move the file in the explorer. Then it complained that it could not find the file.

bump, still have the problem if any one can help

So I found the problem, it turns out that when you make a class manually, i.e. not generating the code files form the editor, the files are placed in “C:\Users\MyComputern\Documents\Unreal Projects\ProjectName\Intermediate\ProjectFiles”

so simply move them into the correct folder, of public/private and it will work