Pointer to incomplete class type is not allowed

I’m trying to access my UCurveLinearColor class.
In .h I declared:

	UPROPERTY( EditAnywhere, BlueprintReadOnly, Category = Default )
	class UCurveLinearColor* SunLightColor;
	UPROPERTY( EditAnywhere, BlueprintReadOnly, Category = Default )
	class UCurveFloat* SunLightIntensity;

Then I tried to access in .cpp:

FLinearColor AManagerTimeOfDay::GetSunLightColor( float time )
{
	return SunLightColor->GetLinearColorValue( time );
}

float AManagerTimeOfDay::GetSunLightIntensity( float time )
{
	return SunLightIntensity->GetFloatValue( time );
}

It is possible to access SunLightIntensity with no issues, but if I try to return the sun color Visual Studio is mentioning the above error. What am I missing?

When writing class UCurveLinearColor SunLightColor;* in the .h you are forward declaring the UCurveLinearColor class.

If you want to use it in the .cpp file you must include the .h in which UCurveLinearColor is really defined, you are just missing a #include “Curves/CurveLinearColor.h” on top of your .cpp file

If some of your #include ends to #include “Curves/CurveFloat.h” somewhere in the include chain it will be inherited and already known as a side effect.

I fixed the missing s in my answer

Ah I see thank you! Actually the correct file path is #include “Curves/CurveLinearColor.h”.

But I wonder why it wasn’t necessary to do the same thing with UCurveFloat. How could I best determinate which files are already included?