std::hash_map missing in VC8?
-
- Gnoblar
- Posts: 9
- Joined: Tue Mar 04, 2003 9:17 am
std::hash_map missing in VC8?
Hi I'm making an Ogre/CEGUI based model viewer/importer/exporter for a game and I wanted to use the CEGUI based file dialog instead of popping up the usual windows dialog.
The thing is that I'm using VC++ 2005 Express, and when trying to compile the CEGUI File Dialog code it complained about std::hash_map which seems missing from whatever STL implementation I'm using there.
What would be the best way around this, use STLPort? could that break something with Ogre or the STL based lib I'm using to read and parse the files?
The thing is that I'm using VC++ 2005 Express, and when trying to compile the CEGUI File Dialog code it complained about std::hash_map which seems missing from whatever STL implementation I'm using there.
What would be the best way around this, use STLPort? could that break something with Ogre or the STL based lib I'm using to read and parse the files?
- haffax
- OGRE Retired Moderator
- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 7
- Contact:
-
- Gnoblar
- Posts: 9
- Joined: Tue Mar 04, 2003 9:17 am
Ok, I installed VC++ 2005 Express, Installed MS Platform SDK, followed the 5 post installation steps linked in some thread here, Installed Ogre SDK 1.0.6 for VC8 and I'm happily using Ogre&CEGUI.
I got the code for the CEGUI File Dialog from the Ogre Wiki:
http://www.ogre3d.org/wiki/index.php/CE ... FileDialog
When compiling I get:
CEGUIHashMapTemplates.h(26) : error C2061: syntax error : identifier 'hash_map'
I got the code for the CEGUI File Dialog from the Ogre Wiki:
http://www.ogre3d.org/wiki/index.php/CE ... FileDialog
When compiling I get:
CEGUIHashMapTemplates.h(26) : error C2061: syntax error : identifier 'hash_map'
- haffax
- OGRE Retired Moderator
- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 7
- Contact:
Ok, I wasn't aware you were trying to compile some wiki posted extension.
I don't know about the error itself here (no compiler available right now), but I am sure, STLPort won't help you. The compiler doesn't complain about missing the hash_map header, so we can savely assume, this template is available (Else Ogre wouldn't work with VC2005 anyway). So the problem lies elsewhere, but I cannot deduct it from the error message.
I don't know about the error itself here (no compiler available right now), but I am sure, STLPort won't help you. The compiler doesn't complain about missing the hash_map header, so we can savely assume, this template is available (Else Ogre wouldn't work with VC2005 anyway). So the problem lies elsewhere, but I cannot deduct it from the error message.
- xavier
- OGRE Retired Moderator
- Posts: 9481
- Joined: Fri Feb 18, 2005 2:03 am
- Location: Dublin, CA, US
- x 22
-
- Gnoblar
- Posts: 9
- Joined: Tue Mar 04, 2003 9:17 am
Yeah, it's so weird it prompted me to ask, normally I tend to google my way out of everything but this time that's not working.
I now have checked and "hash_map" is in there in the Include subdir of VC8, and it contains a typedef for hash_map.
I'm almost suspecting some cut/paste issues with weird characters slipping in the code, will look at the file with an hex editor...
I now have checked and "hash_map" is in there in the Include subdir of VC8, and it contains a typedef for hash_map.
I'm almost suspecting some cut/paste issues with weird characters slipping in the code, will look at the file with an hex editor...
- xavier
- OGRE Retired Moderator
- Posts: 9481
- Joined: Fri Feb 18, 2005 2:03 am
- Location: Dublin, CA, US
- x 22
Yep, after looking at the code, line 26 in the offending file needs to read
in VC8 and above and GCC3.4 and above. It's an ISO C++ strict thing.
Code: Select all
typename hash_map<Z, T>::iterator hashMapIterator;
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
-
- Gnoblar
- Posts: 9
- Joined: Tue Mar 04, 2003 9:17 am
Line 26 is actually:
(This isn't really related to cegui, seems more a general VC8 thing, that's why I initially posted it to the "Back to basics" section.)
Code: Select all
T getEntryFromHashMap (Z id, hash_map<Z, T>* hashMap)
Last edited by Lurb on Sun Dec 11, 2005 1:26 am, edited 1 time in total.
- xavier
- OGRE Retired Moderator
- Posts: 9481
- Joined: Fri Feb 18, 2005 2:03 am
- Location: Dublin, CA, US
- x 22
- haffax
- OGRE Retired Moderator
- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 7
- Contact:
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Normally, this is fixed by OgrePrerequisites.h:
But then you'll have to change the wiki code to use the HashMap define instead of using hash_map directly.
Code: Select all
#if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310
# define HashMap ::__gnu_cxx::hash_map
#else
# if OGRE_COMPILER == OGRE_COMPILER_MSVC
# if OGRE_COMP_VER > 1300 && !defined(_STLP_MSVC)
# define HashMap ::stdext::hash_map
# else
# define HashMap ::std::hash_map
# endif
# else
# define HashMap ::std::hash_map
# endif
#endif
-
- Halfling
- Posts: 52
- Joined: Wed Jun 06, 2007 5:01 pm