I'm trying to put items in a 2dimensional unordered map like this:
#include <unordered_map>
#include <string>
#include <vector>
class Scene {
protected:
static std::unordered_map<std::string, std::unordered_map<std::string, Mesh>> Meshes;
public:
static void loadMesh(std::string filename) {
std::string meshName;
std::vector<GLfloat> v;
std::vector<GLfloat> vn;
etc..
Meshes[filename].emplace(std::make_pair(meshName, Mesh(v, vn, vt, f))); // This causes the error
}
}
I've also tried using this:
Meshes[filename][meshName] = Mesh(v, vn, vt, f);
but it keeps giving me this very long error:
Error 2 error LNK2001: unresolved external symbol "protected: static class std::unordered_map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::unordered_map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Mesh,struct std::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class Mesh> > >,struct std::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::unordered_map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Mesh,struct std::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class Mesh> > > > > > Scene::Meshes" (?Meshes@Scene@@1V?$unordered_map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$unordered_map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VMesh@@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VMesh@@@std@@@2@@2@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$unordered_map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VMesh@@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VMesh@@@std@@@2@@2@@std@@@2@@std@@A) C:\Users\Gebruiker\Documents\Visual Studio 2013\Projects\C++ Projects\Engine\Engine\Scene.obj
Am I using unordered maps the wrong way, or am I missing something?