TMaps of TMaps not working

Hello everybody,

I’m trying to create a Dictonary for my game:

and so I need TMap> s; to work

and it does work fine.

However when I try and initalise

Seeds = SetupSeeds();

It gives me the following error message:

Error 2 error LNK2001: unresolved external symbol “public: static class TMap<int,class TMap<class FString,class FString,class FDefaultSetAllocator,struct TDefaultMapKeyFuncs<class FString,class FString,0> >,class FDefaultSetAllocator,struct TDefaultMapKeyFuncs<int,class TMap<class FString,class FString,class FDefaultSetAllocator,struct TDefaultMapKeyFuncs<class FString,class FString,0> >,0> > MapTest::Seeds” (?Seeds@MapTest@@2V?$TMap@HV?$TMap@VFString@@V1@VFDefaultSetAllocator@@anonymous_user_15ea635e?$TDefaultMapKeyFuncs@VFString@@V1@$0A@@@@@VFDefaultSetAllocator@@anonymous_user_15ea635e?$TDefaultMapKeyFuncs@HV?$TMap@VFString@@V1@VFDefaultSetAllocator@@anonymous_user_15ea635e?$TDefaultMapKeyFuncs@VFString@@V1@$0A@@@@@$0A@@@@@A) E:\Wen Project\InventoryTests\Intermediate\ProjectFiles\MapTest.cpp.obj InventoryTests

//MAPTEST.CPP

#include "InventoryTests.h"
#include "Seed.h"
#include "MapTest.h"

MapTest::MapTest()
{
	Seeds = SetupSeeds();
}

MapTest::~MapTest()
{
}

TMap<int, TMap<FString, FString>> MapTest::SetupSeeds()
{
	// setup out seed data container
	TMap<int, TMap<FString, FString>> s;
	
	// Apple
	TMap<FString, FString> d;
	d.Add("label", "Apple Seed");
	d.Add("amount_of_meshes", "3");
	
	s.Add(0, d);
	
	// Potato
	TMap<FString, FString> e;
	e.Add("label", "Potato Seed");
	e.Add("amount_of_meshes", "3");
	
	s.Add(1, e);
	return s;
}

class ASeed* MapTest::Create(int seedTpye){
	ASeed *seed = new ASeed();
	seed->init(3, 2, "", "", "", 5, "", 1, "");
	return seed;
}

//MAP TEST.h

#pragma once

enum SeedType{
	Apple_Seed,
	Potato_Seed,
};

class INVENTORYTESTS_API MapTest
{
public:
	MapTest();
	~MapTest();

	
	static TMap<int, TMap<FString, FString>> Seeds;
	static TMap<int, TMap<FString, FString>> SetupSeeds();
	
	static class ASeed* Create(int seedTpye);
private:

};

Hi,

It’s not the map-of-maps that’s failing, but the fact you have declared a static (Seeds) but not defined it. You need this in your .cpp file:

TMap<int, TMap<FString, FString>> MapTest::Seeds;

Hope this helps,

Steve

You are a babe <3, thank you so much - Me and my lecturer have spent 3 hours trying to fix this haha.