Proper folder structure for C++

Suppose I have the following directory structure:

  • FPSGame
    • Character
      • Private
        • SomeStuff.cpp
      • Public
        • SomeStuff.h
    • SomeGameMode.h

And In SomeGameMode.h, to include “SomeStuff.h”, I would have to put:

#include “Character/Public/SomeStuff.h”

However, I’ve read the Shooter Example, and various other stuff on UE4, that there’s a way to modify a build file or something so that I can just put

#include “SomeStuff.h”

in SomeGameMode.h

I’m wondering how would I go about doing so, thanks

I believe the answer here should point you in the right direction.

I’ve looked at that exact same question before I posted my question, and that’s where I got the idea that I need to put the header and source files in the public and private folders, before, but as indicated in my question, it didn’t work for me

Ah, I see the issue.

A more typical setup would have the Public and Private folders as top-level folders for your game, rather than folders inside a sub-folder, eg)

 FPSGame
        Public
            Character
                SomeStuff.h
        Private
            Character
                SomeStuff.cpp
        SomeGameMode.h

You can either change your folder layout to be that way, or you could add your Character/Public folder to the PublicIncludePaths in your games .Build.cs file.