Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compiling under VS 2012, string hash ?
05-26-2013, 10:53 AM (This post was last modified: 05-26-2013 10:55 AM by CrystalH.)
Post: #1
Compiling under VS 2012, string hash ?
Hi. I'm trying to build under Visual Studio 2012.
So far it was ok, but I hit 2 errors, beyond my knowledge how to fix it.

Code:
1>c:\w\vs2012\vc\include\xstddef(238): error C2338: The C++ Standard doesn't provide a hash for this type.
1>          c:\w\vs2012\vc\include\type_traits(743) : see reference to class template instantiation 'std::hash<_Kty>' being compiled
1>          with
1>          [
1>              _Kty=StringId
1>          ]
1>          c:\w\vs2012\vc\include\xhash(224) : see reference to class template instantiation 'std::is_empty<_Ty>' being compiled
1>          with
1>          [
1>              _Ty=std::hash<StringId>
1>          ]
1>          c:\w\vs2012\vc\include\unordered_map(22) : see reference to class template instantiation 'std::_Uhash_compare<_Kty,_Hasher,_Keyeq>' being compiled
1>          with
1>          [
1>              _Kty=StringId,
1>              _Hasher=std::hash<StringId>,
1>              _Keyeq=std::equal_to<StringId>
1>          ]
1>          c:\w\vs2012\vc\include\xhash(261) : see reference to class template instantiation 'std::_Umap_traits<_Kty,_Ty,_Tr,_Alloc,_Mfl>' being compiled
1>          with
1>          [
1>              _Kty=StringId,
1>              _Ty=RenderTextureEntry,
1>              _Tr=std::_Uhash_compare<StringId,std::hash<StringId>,std::equal_to<StringId>>,
1>              _Alloc=std::allocator<std::pair<const StringId,RenderTextureEntry>>,
1>              _Mfl=false
1>          ]
1>          c:\w\vs2012\vc\include\unordered_map(80) : see reference to class template instantiation 'std::_Hash<_Traits>' being compiled
1>          with
1>          [
1>              _Traits=std::_Umap_traits<StringId,RenderTextureEntry,std::_Uhash_compare<StringId,std::hash<StringId>,std::equal_to<StringId>>,std::allocator<std::pair<const StringId,RenderTextureEntry>>,false>
1>          ]
1>          c:\w\_pro\vdr\vdrift\src\graphics\gl3v\renderpass.cpp(141) : see reference to class template instantiation 'std::unordered_map<_Kty,_Ty>' being compiled
1>          with
1>          [
1>              _Kty=StringId,
1>              _Ty=RenderTextureEntry
1>          ]

and the second

Code:
1>c:\w\vs2012\vc\include\xstddef(238): error C2338: The C++ Standard doesn't provide a hash for this type.
1>          c:\w\vs2012\vc\include\type_traits(743) : see reference to class template instantiation 'std::hash<_Kty>' being compiled
1>          with
1>          [
1>              _Kty=StringId
1>          ]
1>          c:\w\vs2012\vc\include\xhash(224) : see reference to class template instantiation 'std::is_empty<_Ty>' being compiled
1>          with
1>          [
1>              _Ty=std::hash<StringId>
1>          ]
1>          c:\w\vs2012\vc\include\unordered_map(22) : see reference to class template instantiation 'std::_Uhash_compare<_Kty,_Hasher,_Keyeq>' being compiled
1>          with
1>          [
1>              _Kty=StringId,
1>              _Hasher=std::hash<StringId>,
1>              _Keyeq=std::equal_to<StringId>
1>          ]
1>          c:\w\vs2012\vc\include\xhash(261) : see reference to class template instantiation 'std::_Umap_traits<_Kty,_Ty,_Tr,_Alloc,_Mfl>' being compiled
1>          with
1>          [
1>              _Kty=StringId,
1>              _Ty=std::vector<GLuint>,
1>              _Tr=std::_Uhash_compare<StringId,std::hash<StringId>,std::equal_to<StringId>>,
1>              _Alloc=std::allocator<std::pair<const StringId,std::vector<GLuint>>>,
1>              _Mfl=false
1>          ]
1>          c:\w\vs2012\vc\include\unordered_map(80) : see reference to class template instantiation 'std::_Hash<_Traits>' being compiled
1>          with
1>          [
1>              _Traits=std::_Umap_traits<StringId,std::vector<GLuint>,std::_Uhash_compare<StringId,std::hash<StringId>,std::equal_to<StringId>>,std::allocator<std::pair<const StringId,std::vector<GLuint>>>,false>
1>          ]
1>          c:\w\_pro\vdr\vdrift\src\graphics\gl3v\renderer.cpp(175) : see reference to class template instantiation 'std::unordered_map<_Kty,_Ty>' being compiled
1>          with
1>          [
1>              _Kty=StringId,
1>              _Ty=std::vector<GLuint>
1>          ]

So it's same thing just in 2 files:
src\graphics\gl3v\renderpass.cpp(141)
src\graphics\gl3v\renderer.cpp(175)

I only found this:
In order to view links, you must have to reply to this thread.
Don't know if it helps.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-26-2013, 12:15 PM
Post: #2
RE: Compiling under VS 2012, string hash ?
Change std::tr1::unordered_map <StringId, RenderTextureEntry> to std::tr1::unordered_map <StringId, RenderTextureEntry, StringId::hash>
Find all posts by this user
Quote this message in a reply
05-26-2013, 01:30 PM
Post: #3
RE: Compiling under VS 2012, string hash ?
Thanks, works now.
Was in several places, maybe a typedef for iterator would be shorter.
Anyway here is the patch:
In order to view links, you must have to reply to this thread.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-27-2013, 11:44 AM
Post: #4
RE: Compiling under VS 2012, string hash ?
Yeah, that are some lengthy constructs. I've added a few typedefs to clean it up a bit. Thanks.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)