x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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 >,class FDefaultSetAllocator,struct TDefaultMapKeyFuncs >,0> > MapTest::Seeds" (?Seeds@MapTest@@2V?$TMap@HV?$TMap@VFString@@V1@VFDefaultSetAllocator@@U?$TDefaultMapKeyFuncs@VFString@@V1@$0A@@@@@VFDefaultSetAllocator@@U?$TDefaultMapKeyFuncs@HV?$TMap@VFString@@V1@VFDefaultSetAllocator@@U?$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:
 
 };
 
Product Version: UE 4.9
Tags:
more ▼

asked Jun 29 '16 at 09:55 AM in C++ Programming

avatar image

Lloyd Phillips
3 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Jun 29 '16 at 10:14 AM

avatar image

Steve Robb STAFF
2.8k 58 28 101

avatar image Lloyd Phillips Jun 29 '16 at 10:20 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question