I am receiving an error message for not naming a type, as follows:
error: ‘hash_map’ does not name a type
typedef hash_map<const char*,LexUnitX*,MLexUnitFunctions> MLexUnit;
The code in question creates a custom hash_map
type using a LexUnitX-type struct as shown below:
typedef struct {
int iLexUnit; // lexical unit unique identifier
const char *strLexUnit; // lexical unit as an array of characters (a word, a syllable, etc.)
VLexUnit vLexUnitPronunciations; // alternative pronunciations of the lexical unit
} LexUnitX;
Code for the VLexUnit vector; vector of LexUnit
-type pointers
// lexical unit transcription
typedef struct {
int iLexUnit; // lexical unit id (unique correspondence id <> lexical unit in str format)
int iLexUnitPron; // lexical unit id (unique correspondence id <> lexical unit + pronunciation)
int iIndex; // index of the lexical unit within the lexicon file
vector<int> vPhones; // phonetic transciption
unsigned char iPronunciation; // pronunciation number
unsigned char iType; // standard / filler / sentence delimiter
float fProbability; // pronunciation probability (respect to alternative ones of the same lex unit)
float fInsertionPenalty; // penalty for inserting this lexical unit during decoding
} LexUnit;
class LexiconManager;
typedef vector<LexUnit*> VLexUnit;
and finally the hash_map
type to map characters to their corresponding data structure:
// maps lexical units as strings of characters to their corresponding data structure
#if defined __linux__ || defined __APPLE__ || __MINGW32__
typedef std::tr1::unordered_map<const char*,LexUnitX*,MLexUnitFunctions,MLexUnitFunctions> MLexUnit;
#elif _MSC_VER < 1700
typedef hash_map<const char*,LexUnitX*,MLexUnitFunctions> MLexUnit;
#else
#error "unsupported platform"
#endif
I am not sure what exactly I am doing wrong syntatically here to cause the error.