Subfolders in C++ project

How do I use subfolders with C++ project?

I’m talking about creating subfolder within one of the source folder and compiling source code from there.

The recommended way to create classes is using UE4 editor, and it does not support subfolders for C++ classes/code. I suspect that using visual studio is not the right way to do it (because visual studio project files can be regenerated later). Am I supposed to edit *.cs files manually or something?

The UE4 class wizard does support sub-folders, you just have to type them in manually (or use the browse button) when creating your new class. It’s only the Content Browser that doesn’t let you create new folders for C++ source locations.

Well, let’s say I need to create a .h/.cpp pair that stores multiple commonly used functions/namespaces and maybe some structures that are not used with USTRUCT/UProperty system. Would that still work? C++ class wizard is class centric, and I sorta occasionally need to work on files, not classes.

Sure, just make sure they exist somewhere within the Source folder of your project, and then re-generate your project in order to add the new files to your solution.

“they exist somewhere within the Source folder” So, you’re saying that project is generated based on contents of source folder (i.e. .h / .cpp files within it)? Not based on .cs files? I had impression that .cs were using in same way as makefiles.

The C# files define modules and targets, but any source files within a module are automatically picked up when generating projects.

Are you asking how to create a new common module?

No, it is just you mentioned very interesting detail I wasn’t aware of, so I wanted to clarify it.

I’m marking this as accepted/answered. Thanks for assistance.