Hello life savers,
I'm having trouble compiling a specific program. The program was originally written for gcc and was compiled successfully under it. When trying to compile under Solaris 11, I get this error:
"Hashtable.h", line 170: Error: Could not find a match for hash needed in Hashtable<long long, Orderbook*>::get(long long).
"ReferenceData.cpp", line 59: Where: While instantiating "Hashtable<long long, Orderbook*>::get(long long)".
"ReferenceData.cpp", line 59: Where: Instantiated from non-template code.
line 170 of file "Hashtable.h" is:
int tIndex = (hash(pKey,mSize));
(line 59 of "ReferenceData.cpp" is using it).
The "hash" functions are global, and are defined as followed:
static int hash( int64 pValue, int pMod )
{
int tValue = (int) (pValue & 0x7FFFFFFF);
return (tValue % pMod);
}
static int hash( int pValue, int pMod )
{
return (pValue % pMod);
}
static int hashString( const char *pStr, int pMod )
{
int tLen = (int) strlen( pStr );
unsigned int hash = 0;
unsigned int x = 0;
for(int i = 0; i < tLen; pStr++, i++)
{
hash = (hash << 4) + (*pStr);
if((x = hash & 0xF0000000L) != 0)
{
hash ^= (x >> 24);
}
hash &= ~x;
}
return (int) (hash % pMod);
}
static int hash( const std::string *pStr, int pMod )
{
return hashString( pStr->c_str(), pMod );
}
static int hash( const char *pStr, int pMod )
{
return hashString( pStr, pMod );
}
Please tell me if the pasted code is enough or you need the entire class code for finding what's wrong (didn't want to paste the whole thing. it's long....).
Thanks a lot.
yp515.