• Advertisement
Sign in to follow this  

[Visual Studio 2008] error C2512 no appropriate default constructor available

This topic is 2616 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello.. I can't understand why i've this compile error.. This is my code:

IComponent.h
#ifndef ICOMPONENT_H_
#define ICOMPONENT_H_
//#include "GameObject.h"
#include "ComponentMessage.h"
#include "GameObject.h"

namespace Platform
{
namespace GameObjets
{
class GameObject;
}

namespace Components
{
class IComponent
{
public:
virtual void Init() = 0;
virtual void Update() = 0;
virtual void Deinit() = 0;
virtual void ExecuteMessage(ComponentMessage *iMessage)
{
/* By default this method don't do nothing.. So every
component that want to do something with a message,
can override this method! */
};

void SetOwner(GameObjects::GameObject *iGameObject)
{
mGameObject = iGameObject;
}

GameObjects::GameObject *GetOwner()
{
return mGameObject;
}

private:
GameObjects::GameObject *mGameObject;
};
}
}

#endif


AnimationComponent.h
#ifndef ANIMATIONCOMPONENT_H_
#define ANIMATIONCOMPONENT_H_
#include "IComponent.h"

namespace Platform
{
namespace Components
{
namespace Animation
{
class AnimationComponent : public IComponent
{
public:
virtual void Init() = 0;
virtual void Update() = 0;
virtual void Deinit() = 0;
virtual void ExecuteMessage() {};

virtual void SetAnimation(const Ogre::String &iAnimationID, bool loop)
{
...
}

virtual void Blend(const Ogre::String &iAnimationID, Ogre::Real iDuration, bool iLoop)
{
...
}

Ogre::Entity *GetEntity()
{
return mEntity;
}

void SetEntity(Ogre::Entity *iEntity)
{
mEntity = iEntity;
}
protected:

virtual void PerformIdle() {};

protected:
Ogre::Quaternion mOrientation;

/* Animation Parameters */
Ogre::AnimationState *mAnDestination;
Ogre::AnimationState *mAnimationState;
Ogre::AnimationStateSet *mAnimationSet;
Ogre::AnimationStateIterator mAnimationItr;
Ogre::Real mTimeLeft;
Ogre::Real mDuration;
bool mComplete;
bool mLoop;

Ogre::Entity *mEntity;
};
}
}
}
#endif


ProtagonistAnimationComponent.h

#ifndef PROTAGONISTANIMATIONCOMPONENT_H_
#define PROTAGONISTANIMATIONCOMPONENT_H_

#include <Ogre.h>
#include "AnimationComponent.h"

namespace Platform
{
namespace Components
{
namespace Animation
{
class ProtagonistAnimationComponent : public AnimationComponent
{
public:
ProtagonistAnimationComponent();
~ProtagonistAnimationComponent();
void Init();
void Update();
void Deinit();

protected:
void ExecuteMessage(ComponentMessage *iMessage);
void PerformIdle();
void PerformOrientation();
private:

private:
Ogre::Degree mAngle;
Ogre::Quaternion mOrToReach;

};
}
}
}

#endif


I recieve the error when i try to define the costructor of my class ProtagonistAnimationComponent, the strange thing is that i can compile without problem all others Components like "Movable, Renderable" etc etc..

Anyone can help me? Thanks a lot!

Share this post


Link to post
Share on other sites
Advertisement
I've no idea why, but this declaration, cause the problem:

Ogre::AnimationStateIterator mAnimationItr;


So now it work without problem ò_ò.

Share this post


Link to post
Share on other sites
That would be because AnimationStateIterator doesn't have a default constructor. It's two constructors take either a AnimationStateMap reference or two AnimationStateMap::iterators.

Share this post


Link to post
Share on other sites
Argh! Ok thanks! But the compiler give me the error on the costructor of my class.. So i was confused.. Thanks again, i will try to fix it!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement