Original Post
I'm trying to compile my Manta-X project under GCC 3.3.4 and have run into some problems with the messaging system that my Entities are relying upon. The project was coded mainly in VC++7 and I received no problems at all, so I'm wondering if I'm not quite adhering to some standard or something. So far I've had a few errors and wranings thrown back at me, but they're mainly to do with reinforcing const references - this one is alluding me. The message functor template class is defined as: In my Entity class I have a member function int Entity::OnUpdate( sEntityMessageInfo *msg). The problem occurs when I register the message with my handler, or more specifically when I'm creating a new instance of the templated functor eg: IEntityMessageFunctor *test = new TEntityMessageFunctor(this, OnUpdate); The errors I'm getting from GCC follow: The thing is, I'm stumped. I've played around with it for a while and just can't figure it out - google's not helping much either so I thought I'd throw it out here. Does anyone know what I'm doing wrong here? Thanks -Oli [Edited by - evolutional on December 6, 2004 4:56:16 AM]
class IEntityMessageFunctor : public IMMO
{
public:
virtual int operator()(sEntityMessageInfo *msg) = 0; // call using operator
virtual int Call(sEntityMessageInfo *msg) = 0; // call using function
};
template <class TClass> class TEntityMessageFunctor : public IEntityMessageFunctor
{
private:
typedef int (TClass::*FUNCTOR)(sEntityMessageInfo *msg); // pointer to member function
TClass* pt2Object; // pointer to object
FUNCTOR fpt;
public:
TEntityMessageFunctor ( TClass* _pt2Object, FUNCTOR _fpt )
{
pt2Object = _pt2Object;
fpt=_fpt;
}
// SNIP
};
Entity.cpp: error: no matching function call to
MantaX::TEntityMessageFunctor<MantaX::Entity>::TEntityMessageFunctor( MantaX::Entity* const, <unknown type>)
Candidates are:
MantaX::TEntityMessageFunctor<MantaX::Entity>::TEntityMessageFunctor(const MantaX::TEntityMessageFunctor<MantaX::Entity>& )