Issue with includes after migrating from 4.18 to 4.25

Say we have MyProject as project name.

In 4.18 I’d do

#include "Characters/BaseCharacter.h"

where the implied path is something like C:/Unreal/MyProject_418/Source/MyProject/Characters/BaseCharacter.h

In 4.25, that no longer works. It gives me an error telling me it can’t find the specified file. Instead, what does work is

#include "MyProject/Characters/BaseCharacter.h"

I need someone to either confirm or refute the fact that this is how it’s supposed to be. Perhaps something got messed up during the upgrade process in my case.

You could just make a blank project to compare, moved a 4.22 myself without the problem, and all my includes still work, So my guess is that something went wrong. My suggestion would be to make a blank and then migrate things… actually that is what I did to solve another problem.

That is correct. I can’t remember the name of UBT flag which they changed to do that. Maybe bLegacyPublicIncludePaths, not sure. I think it is generally considered an old way, so I would not reenable it. You can add your folder paths to Build.cs using


so folder will scanned for includes.

Thanks. I prefer to follow the original design, which means that I’ll be using the new way from now on.

To anyone wondering: there’s a simple way to enable back the old way. Shove this into your project’s Build.cs file, then close VS and generate solution files from scratch:

bLegacyPublicIncludePaths = true;

But I recommend not relying on outdated/deprecated designs. It is generally not a good practice to stick to the old ways of doing things, since that slows down your overall progress and experience as a developer. People more experienced than you and me have decided that the new way is, for one reason or another, better than the old one; I choose to respect their experience, since it exceeds my own greatly.