.h file fails to build because it cannot find #include path to... itself?

Hey all, I ran into a weird one. I’m probably missing something fairly basic, but I’m attempting to implement the Gameplay Ability System plugin, coding my first Attribute set, and… this happened:

Now, I’m no fool, but that seems to be saying that on line 7 of CharacterAttributes.h the include path can’t be found for UCharacterAttributes.h.

For reference, here’s the referenced line:

image

I’m honestly unsure what’s going on here. I have to be misunderstanding something, right? I actually included ‘UCharacterAttributes.h’ in CharacterAttributes.h once just to see what it did, and it successfully told me off for giving it a circular include path, so can anyone shed some light on what it’s trying to tell me?

When including files don’t type the unreal prefix U, A, F etc
so if you want to include the class UCharacterAttributes then the corresponding name of the header would be CharacterAttributes.h

Please write out is you file structure and what you are trying to include

If the file you are showing in the screenshot is CharacterAttributes.h (based on the generated line) then you cannot include itself in itself.

The only place that should include CharacterAttributes.h by default would be in
CharacterAttributes.cpp.

Also read up on forward declarations (you add a prefix of class, struct etc) to a specific property to not have to include it’s header inside the class header (only include it in the classes cpp file)

Turns out I was, in fact, a fool. Eagle-eyed readers may notice that it was not telling me that CharacterAttributes.h couldn’t find Character attributes.h. It was Character_Base that couldn’t find the path.

I, as it turns out, am not eagle-eyed XD

1 Like