How include works

Ok so first off i wasn’t able to think of a better name for the question but i do know what include is and what id does but it seems i am either not working with it correctly or am making a really stupid mistake

i am going to start with a very simple one using the c++ side scroller template i tried to make an actor with a simple ArrowComponent i did everything as was done in the character class regarding the CameraComponent and SpringArmComponent but i kept on getting compiler errors. i tried to replicate every aspect of the character class into my simple actor class but it wouldn’t work and in the end i just tried adding the arrow component to the character only to see it doesn’t work?!?!?!?!?! so i did something i just kept saying is stupid in the include directory i added this

#include “Runtime/Engine/Classes/Components/ArrowComponent.h”

and it worked… but this doesn’t make any sense??? since this was not done for any of the other components that were added the same way my arrow component was added!!!

i am confused but happy in some way since every time i approached c++ i would have problems with this kind of stuff i never got to actually do anything because i would waste hours trying to add a stupid component to my actor

so please i am really confused on how a class knows of something but doesn’t know of something real similar i mean you’d think an actor would know about components since it doesn’t even show any error before compiling and even the erroe it gives at compilation time doesn’t realy direct me to where the problem is but takes me to an engine class i don’t realy know anything about

thanks in advance

some pics of problem:

i had a similar problem yesterday that i could not use some UComponents in my Vehicle c++ project without the include, that where used without include in a Tutorial( Basic Code project).
so i looked for differences and found them in ModulName.h(in your case ModularSciFi.h) they use different includes.

Basic Code project includes Engine.h while the Vehicle project only includes CoreUObject.h

so if you dont want to include most UComponents, you can change your include to Engine.h

You are completely correct!!! Thnx Alot!