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

Started by
2 comments, last by Tano_ITA 13 years, 4 months ago
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!

Advertisement
I've no idea why, but this declaration, cause the problem:

Ogre::AnimationStateIterator mAnimationItr;


So now it work without problem ò_ò.
That would be because AnimationStateIterator doesn't have a default constructor. It's two constructors take either a AnimationStateMap reference or two AnimationStateMap::iterators.
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!

This topic is closed to new replies.

Advertisement