I am triying to create camera and spring arm components. I know that i need to use forward declartion. I am sure i did correctly but visual studio say " pointer to incomplete class type “UCameraComponent” is not allowed" when i try to reach functions of cam variable. I get this eror trying to create spring arm component too but I can create static mesh component also I am able to reach its functions. Can you help me?
No, you can not use forward declarations here. You need to add the corresponding header file (#include “Camera/CameraComponent.h”).
Forward declarations are mostly useful in header files.
Forward declaration is the way to tell to the compiler that “There is indeed a class with that name, don’t try to find it, just believe me”.
But to access that class you still have to #include it in .cpp.
Basically forward declarations are used to avoid including bunch of classes to .h