C3767 error

  • Thread starter Thread starter JW
  • Start date Start date
J

JW

I received this error while compiling OSE 6.0 with MSVC7.1
(it compiles with MSVC7.0).

otcbitset.cc
.../include\OTC\collctn\strgactn.hh(45) : error
C3767: 'otclib_hash' matching function is not accessible
could be the friend function
at '../include\OTC\misc\hash.hh(54)' : 'otclib_hash' [may
be found via argument-dependent lookup]
or the friend function
at '../include\OTC\misc\hash.hh
(64)' : 'otclib_hash' [may be found via argument-
dependent lookup]
.../include\OTC\collctn\strgactn.hh(55) : error
C3767: 'otclib_hash' matching function is not accessible
could be the friend function
at '../include\OTC\misc\hash.hh(54)' : 'otclib_hash' [may
be found via argument-dependent lookup]
or the friend function
at '../include\OTC\misc\hash.hh
(64)' : 'otclib_hash' [may be found via argument-
dependent lookup]


The info in the MSDN help wasn't clear to me.

Here are the two files causing the problem.

strgactn.hh

template<>
class OSE_EXPORT OTC_HashActions<char*>
{
public:
static int hash(char* const& s)
{ return otclib_hash(s); }
};

template<>
class OSE_EXPORT OTC_HashActions<const char*>
{
public:
static int hash(const char* const& s)
{ return otclib_hash(s); }
};


hash.hh

class OSE_EXPORT OTC_Hash
{
public:

static int hash(char const* theString);

friend inline int otclib_hash(char const* theString)
{ return OTC_Hash::hash
(theString); }

static int hash(char const* theString, u_int
theLength);

friend inline int otclib_hash(char const* theString,
u_int theLength)
{ return OTC_Hash::hash
(theString,theLength); }



Anyone know how to fix it?

Thanks.
 
I got it.

Had to declare the friend function header inside the class
and implement it outside the class. I'm not sure if
that's the correct way to do it, but it works.
 
Back
Top