Hi, I’m constantly having errors when I’m trying to build a TMap with FString as key and TFunction as values. Here are my codes:
Something.h
TMap<FString, TFunction<void(USomeActorComponent::*)()>> StringFunctionMap;
Something.cpp
USomeActorComponent::USomeActorComponent()
{
PrimaryComponentTick.bCanEverTick = false;
SetIsReplicated(true);
StringFunctionMap.Add(TEXT("FunctionA"), &USomeActorComponent::BlahBlah);
}
My errors
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/Function.h(527) : error C2504: 'UE4Function_Private::TFunctionRefBase<TFunction<void (__cdecl USandboxComponent::* )(void)>,FuncType>': base class undefined
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: FuncType=void (__cdecl USomeActorComponent::* )(void)
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/UnrealTypeTraits.h(291) : note: see reference to class template instantiation 'TFunction<void (__cdecl USomeActorComponent::* )(void)>' being compiled
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/UnrealTypeTraits.h(304) : note: see reference to class template instantiation 'TCallTraitsBase<T>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: T=TFunction<void (__cdecl USomeActorComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/UnrealTypeTraits.h(357) : note: see reference to class template instantiation 'TCallTraits<T>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: T=TFunction<void (__cdecl USomeActorComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/UnrealTypeTraits.h(368) : note: see reference to class template instantiation 'TTypeTraitsBase<T>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: T=TFunction<void (__cdecl USandboxComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Containers/Map.h(114) : note: see reference to class template instantiation 'TTypeTraits<ValueType>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: ValueType=TFunction<void (__cdecl USandboxComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Containers/Map.h(752) : note: see reference to class template instantiation 'TMapBase<KeyType,ValueType,SetAllocator,KeyFuncs>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: KeyType=FString,
CompilerResultsLog: ValueType=TFunction<void (__cdecl USomeActorComponent::* )(void)>,
CompilerResultsLog: SetAllocator=FDefaultSetAllocator,
CompilerResultsLog: KeyFuncs=TDefaultMapHashableKeyFuncs<FString,TFunction<void (__cdecl USomeActorComponent::* )(void)>,false>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Containers/Map.h(859) : note: see reference to class template instantiation 'TSortableMapBase<KeyType,ValueType,SetAllocator,KeyFuncs>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: KeyType=FString,
CompilerResultsLog: ValueType=TFunction<void (__cdecl USomeActorComponent::* )(void)>,
CompilerResultsLog: SetAllocator=FDefaultSetAllocator,
CompilerResultsLog: KeyFuncs=TDefaultMapHashableKeyFuncs<FString,TFunction<void (__cdecl USomeActorComponent::* )(void)>,false>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\SVN\Source\ProjectCombine\Public\Components\USomeActorComponent.h(37) : note: see reference to class template instantiation 'TMap<FString,TFunction<void (__cdecl USomeActorComponent::* )(void)>,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<KeyType,ValueType,false>>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: KeyType=FString,
CompilerResultsLog: ValueType=TFunction<void (__cdecl USomeActorComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/Function.h(527) : error C2504: 'UE4Function_Private::TFunctionRefBase<TFunction<void (__cdecl USomeActorComponent::* )(void)>,FuncType>': base class undefined
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: FuncType=void (__cdecl USomeActorComponent::* )(void)
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/UnrealTypeTraits.h(291) : note: see reference to class template instantiation 'TFunction<void (__cdecl USomeActorComponent::* )(void)>' being compiled
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/UnrealTypeTraits.h(304) : note: see reference to class template instantiation 'TCallTraitsBase<T>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: T=TFunction<void (__cdecl USomeActorComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/UnrealTypeTraits.h(357) : note: see reference to class template instantiation 'TCallTraits<T>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: T=TFunction<void (__cdecl USomeActorComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Templates/UnrealTypeTraits.h(368) : note: see reference to class template instantiation 'TTypeTraitsBase<T>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: T=TFunction<void (__cdecl USomeActorComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Containers/Map.h(114) : note: see reference to class template instantiation 'TTypeTraits<ValueType>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: ValueType=TFunction<void (__cdecl USomeActorComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Containers/Map.h(752) : note: see reference to class template instantiation 'TMapBase<KeyType,ValueType,SetAllocator,KeyFuncs>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: KeyType=FString,
CompilerResultsLog: ValueType=TFunction<void (__cdecl USomeActorComponent::* )(void)>,
CompilerResultsLog: SetAllocator=FDefaultSetAllocator,
CompilerResultsLog: KeyFuncs=TDefaultMapHashableKeyFuncs<FString,TFunction<void (__cdecl USomeActorComponent::* )(void)>,false>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\Epic Games\Engine\Source\Runtime\Core\Public\Containers/Map.h(859) : note: see reference to class template instantiation 'TSortableMapBase<KeyType,ValueType,SetAllocator,KeyFuncs>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: KeyType=FString,
CompilerResultsLog: ValueType=TFunction<void (__cdecl USomeActorComponent::* )(void)>,
CompilerResultsLog: SetAllocator=FDefaultSetAllocator,
CompilerResultsLog: KeyFuncs=TDefaultMapHashableKeyFuncs<FString,TFunction<void (__cdecl USomeActorComponent::* )(void)>,false>
CompilerResultsLog: ]
CompilerResultsLog: Error: D:\SVN\Source\ProjectCombine\Public/Components/USomeActorComponent.h(37) : note: see reference to class template instantiation 'TMap<FString,TFunction<void (__cdecl USomeActorComponent::* )(void)>,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<KeyType,ValueType,false>>' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: KeyType=FString,
CompilerResultsLog: ValueType=TFunction<void (__cdecl USomeActorComponent::* )(void)>
CompilerResultsLog: ]
CompilerResultsLog: ERROR: UBT ERROR: Failed to produce item: D:\SVN\Binaries\Win64\UE4Editor-ProjectCombine-3410.dll
CompilerResultsLog: Total build time: 32.55 seconds (Local executor: 0.00 seconds)
Any help will be appreciated, thanks.