Download

Array of Interface problem

Hi everyone !

Well I would like to store an array of object who implements my interface, I declare these following lines:


static TArray<FScriptInterface<IMyInterface>> MyArray

At this point, all compile fine, but if I add a function to get an item in my array like this:



TScriptInterface<IMyInterface> UMyClass::GetMyInterfaceObject(int32 Index)
{
	return MyArray[Index];
}


Compile fail, with an LNK2001 code error and this message : “external symbol not resolved “public: static class TArray<class TScriptInterface<class IMyInterface>,class FDefaultAllocator> UMyClass::MyArray” (?MyArray@UMyClass@@2V?$TArray@V?$TScriptInterface@VIMyInterface@@@@VFDefaultAllocator@@@@A)”

I work with UE4 4.10.4, maybe it’s a know issue.

Thank you in advance for your help :slight_smile:

Problem solve, for static Array you need to declare in your .cpp :


 TArray<MyItemClass> UMyClass::MyArray;