template-id `hash<const char*>' used as a declarator

PARK,YOUNG-HYUN park507@ufl.edu
Wed Aug 20 05:19:00 GMT 2003


Hello,
I have the compile problem with gcc.

template-id `hash<const char*>' used as a declarator

I got Linux 8.0 gcc 3.2.
Is there anyone can help me???
Thank you ahead.


----------------------
LESCompare.hxx

#ifndef TEXT_LCS_COMPARE
#define TEXT_LCS_COMPARE
#include <string>
using namespace std;

#ifndef __SGI_STL_HASH_SET
#define __SGI_STL_HASH_SET

#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
#include <stl_hashtable.h>
using namespace std;
#endif

#include <ext/hash_set>
using namespace std;
#endif /* __SGI_STL_HASH_SET */

typedef unsigned char HashIndexType;

struct strHash
{
  HashIndexType hash<const char*> H;

  size_t operator()(string s) const
  {
    return H(s.data());
  }
};

struct Point
{
  int x;
  int y;
};

   bool isSimilar(const string& x,const string& y);
   bool isSimilar(const int& LCSLen,const int& N,const int& M);
   int computeLESLen(const string& s1,const string& s2,int** 
vbuf=0);
   void getPathPoints(int** vbuf,int LES,const string& sx,string& 
sy,vector<Point>& retPath);
#endif

------------------
[root@ubidata vdiff]# make
Compile LESCompare.cxx
/usr/bin/g++ -c -I/usr/xerces-c-src1_4_0/include         
-DXERCES14=1 -Wno-deprecated -Wall -g -pg -o LESCompare.o 
LESCompare.cxx
In file included from LESCompare.cxx:7:
LESCompare.hxx:22: template-id `hash<const char*>' used as a 
declarator
LESCompare.hxx:22: parse error before `;' token
LESCompare.hxx: In member function `size_t
   strHash::operator()(std::basic_string<char, 
std::char_traits<char>,
   std::allocator<char> >) const':
LESCompare.hxx:26: `H' undeclared (first use this function)
LESCompare.hxx:26: (Each undeclared identifier is reported only 
once for each
   function it appears in.)
make: *** [LESCompare.o] Error 1

------------------------------------


--
PARK,YOUNG-HYUN



More information about the Gcc-help mailing list