[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem compiling cml/cmapi/src/CM_cache.cpp on RHEL4 (gcc 3.4.4)



Hello,
I am a newbie trying to build the smp. I have encountered a problem when
trying to compile CM_cache.cpp. There is a member function from the
CertCache class named LoadTrustAnchor. It is declared as a friend in the
CachedCert class however it is not in scope (because it is a private
member function of CertCache) when the compiler tries to compile
CM_cache.h.

Here is the tail of the build log:
make[2]: Entering directory
`/home/scott/src/ssc/pki/trunk/src/smp/cml/cmlasn/src'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory
`/home/scott/src/ssc/pki/trunk/src/smp/cml/cmlasn/src'
(/bin/sh /home/scott/src/ssc/pki/trunk/src/smp/build/mkinstalldirs
/home/scott/src/ssc/pki/trunk/src/smp/../SMPDist/include/smp)
(/bin/sh /home/scott/src/ssc/pki/trunk/src/smp/build/mkinstalldirs
/home/scott/src/ssc/pki/trunk/src/smp/../SMPDist/include/smp/Modules)
(cd cmapi/inc; cp -f *.h
/home/scott/src/ssc/pki/trunk/src/smp/../SMPDist/include/smp)
(cd cmapi/src; make)
make[2]: Entering directory
`/home/scott/src/ssc/pki/trunk/src/smp/cml/cmapi/src'
g++ -c -fPIC -Wall -DLinux -D_UNIX  -I../../cmapi/inc -I../../cmlasn/inc
-I../../crlsrv_dll/inc -I../../../pkcs11_cryptopp/inc -I../../srl/inc
-I/usr/local/include/esnacc/c++ CM_cache.cpp -o CM_cache.o
In file included from CM_cache.cpp:21:
../../cmapi/inc/CM_cache.h:285: error: `short int
CML::Internal::CertCache::LoadTrustAnchor(const CML::TrustAnchor&,
CML::ErrorInfoList*)' is private
../../cmapi/inc/CM_cache.h:364: error: within this context


A generic representation of this is:
friend.h
//==========================================================
class B;

class A
{
 private:
	int x;
	int f();
};

class B
{
 public:
	friend int A::f();
};
//==========================================================

friend.cpp
//==========================================================
#include "friend.h"

int A::f()
{
	return 0;
}
//==========================================================

[scott@choke scratch]$ g++ -c -fPIC -Wall -DLinux friend.cpp -o friend.o
In file included from friend.cpp:1:
friend.h:7: error: `int A::f()' is private
friend.h:13: error: within this context



Short of modifying the CertCache class and moving this member function
public does anyone have any suggestions? I tried making CachedCert a
friend of class CertCache (as a test) but this generated more compiler
errors than this initial error.

cheers,
scott