Hi all,
Getting this error when trying to compile for 5.5
1>E:\Unreal\Engine\UE_5.5\Engine\Source\Runtime\CoreUObject\Public\Templates\Casts.h(126): error C2338: static_assert failed: ‘Attempting to use Cast<> on a type that is not a UObject or an Interface’
1>E:\Unreal\Engine\UE_5.5\Engine\Source\Runtime\CoreUObject\Public\Templates\Casts.h(126): note: the template instantiation context (the oldest one first) is
1>E:\Unreal\RPG_5.4\Plugins\CISQLite3\Source\CISQLite3\Private\SQLiteDatabase.cpp(840): note: see reference to function template instantiation ‘To *Cast<FInt64Property,FProperty>(From *)’ being compiled
1> with
1> [
1> To=FInt64Property,
1> From=FProperty
1> ]
the line in question is :
if ((int64prop = Cast(targetProperty)) != NULL)
and the function in total is :
void USQLiteDatabase::AssignResultsToObjectProperties(const SQLiteResultValue& ResultValue, UObject* ObjectToPopulate)
{
auto propertyMap = CollectProperties(ObjectToPopulate);
for (SQLiteResultField field : ResultValue.Fields)
{
if (propertyMap.Contains(field.Name))
{
FProperty* targetProperty = propertyMap[field.Name];
if (field.Type == SQLiteResultValueTypes::Integer)
{
FInt64Property* int64prop = NULL;
FIntProperty* int32prop = NULL;
FInt16Property* int16prop = NULL;
FInt8Property* int8prop = NULL;
FBoolProperty* boolProp = NULL;
if ((int64prop = Cast<FInt64Property>(targetProperty)) != NULL)
{
int64prop->SetPropertyValue_InContainer(ObjectToPopulate, field.IntValue);
LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
}
else if ((int32prop = Cast<FIntProperty>(targetProperty)) != NULL)
{
int32prop->SetPropertyValue_InContainer(ObjectToPopulate, (int32)field.IntValue);
LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
}
else if ((int16prop = Cast<FInt16Property>(targetProperty)) != NULL)
{
int16prop->SetPropertyValue_InContainer(ObjectToPopulate, (int16)field.IntValue);
LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
}
else if ((int8prop = Cast<FInt8Property>(targetProperty)) != NULL)
{
int8prop->SetPropertyValue_InContainer(ObjectToPopulate, (int8)field.IntValue);
LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
}
else if ((boolProp = Cast<FBoolProperty>(targetProperty)) != NULL)
{
boolProp->SetPropertyValue_InContainer(ObjectToPopulate, field.IntValue > 0);
LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
}
}
else if (field.Type == SQLiteResultValueTypes::Float)
{
FDoubleProperty* doubleProp = NULL;
FFloatProperty* floatProp = NULL;
if ((doubleProp = Cast<FDoubleProperty>(targetProperty)) != NULL)
{
doubleProp->SetPropertyValue_InContainer(ObjectToPopulate, field.DoubleValue);
LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%f'"), *field.Name, field.DoubleValue));
}
else if ((floatProp = Cast<FFloatProperty>(targetProperty)) != NULL)
{
floatProp->SetPropertyValue_InContainer(ObjectToPopulate, (float)field.DoubleValue);
LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%f'"), *field.Name, field.DoubleValue));
}
}
else if (field.Type == SQLiteResultValueTypes::Text)
{
FStrProperty* strProp = NULL;
if ((strProp = Cast<FStrProperty>(targetProperty)) != NULL)
{
strProp->SetPropertyValue_InContainer(ObjectToPopulate, field.StringValue);
LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%s'"), *field.Name, *field.StringValue.Mid(0, 64)));
}
}
}
}
}
Any help please