Unable to create C++ Class Folders UE5 2022 Edition

TLDR: I have read two earlier posts from 2015 and 2019, but both are for UE4, and even after trying to make them work didn’t succeed and figured I’d make a UE5 2022 post about this.

First, I’m super new to Unreal Engine and game dev in general so bear with me in case I use the wrong terms or anything like that.

I’m trying to create sub folders for my C++ classes as I predict it would become mega unorganized later on and better start now. I looked this up and tried 2 UE4 ‘methods’ of going about this, as apparently making a C++ class folder hasn’t been implemented yet.

However, after trying to follow both methods (manually make the folders and rebuild the UE5 project OR create the folders on C++ class creation) both methods didn’t work for me.

The first method I was unable to select rebuild the UE5 project. After messing about and deciding to just launch the project I noticed it successfully noticed the folders & the classes inside them. However when opening them in VS2022

And the 2nd method successfully created the class & subfolder but it didn’t show up. I get a message to reload, so I do. And I get an error. Relevant images below
msg 1

msg 2

I would prefer to be able to create the folders in Engine by doing it on new class creation, however at this point just being able to sort my classes whilst working would be fantastic.

Thanks in advance,

Hey, as this post was pending I’ve fixed the problem. As usual, it was quite a dumb mistake.

I’ll explain what I did to solve it for anyone reading this however.

The first problem I had was that I somehow had 2 duplicate classes so any changes I made to the one I was trying to fix caused the 2nd one to throw errors anyway.

The second thing I fixed, which in hindsight should’ve been obvious but I must’ve read over it was the changing the #include from:

#include “/Enemies/BaseEnemyClass.h”
#include “…/Source/Particle/Enemies/BaseEnemyClass.h”

Afterwards I rebuild my project inside of VS2022 (don’t think this was necessary though)
And then compiled again inside UE5.0.2 itself.

Simply adding the folders manually, fixing the header & compiling in the engine managed to smoothly move my other classes to sub folders. Did not need to delete Binaries, Intermediate & the VS .sln file.

Hope my simple mistake might help someone else though.