Ogniok
Member
|
Cannot instantiate abstract class
Hi!
I have "SpecialPoint" class i my game based on Game::Obj. When compiling I got this error:
Code:
error C2259: 'SpecialPoint' : cannot instantiate abstract class
1> due to following members:
1> 'void EE::Game::Obj::pos(const EE::Vec &)' : is abstract
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\game\object.h(22) : see declaration of 'EE::Game::Obj::pos'
1> 'EE::Vec EE::Game::Obj::pos(void)' : is abstract
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\game\object.h(21) : see declaration of 'EE::Game::Obj::pos'
1> 'void EE::Game::Obj::matrix(const EE::Matrix &)' : is abstract
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\game\object.h(24) : see declaration of 'EE::Game::Obj::matrix'
1> 'EE::Matrix EE::Game::Obj::matrix(void)' : is abstract
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\game\object.h(23) : see declaration of 'EE::Game::Obj::matrix'
1> 'Bool EE::Game::Obj::update(void)' : is abstract
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\game\object.h(47) : see declaration of 'EE::Game::Obj::update'
1> 'UInt EE::Game::Obj::drawPrepare(void)' : is abstract
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\game\object.h(50) : see declaration of 'EE::Game::Obj::drawPrepare'
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\misc\misc.h(144) : while compiling class template member function 'void EE::ClassFunc<TYPE>::New(Ptr)'
1> with
1> [
1> TYPE=SpecialPoint
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\misc\memory containers.h(272) : see reference to class template instantiation 'EE::ClassFunc<TYPE>' being compiled
1> with
1> [
1> TYPE=SpecialPoint
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\misc\memory containers.h(272) : while compiling class template member function 'EE::Memx<TYPE>::Memx(Int)'
1> with
1> [
1> TYPE=SpecialPoint
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\esenthelengine\game\world.h(16) : see reference to class template instantiation 'EE::Memx<TYPE>' being compiled
1> with
1> [
1> TYPE=SpecialPoint
1> ]
1> d:\rts\source\game.h(11) : see reference to class template instantiation 'EE::Game::ObjMemx<TYPE>' being compiled
1> with
1> [
1> TYPE=SpecialPoint
1> ]
This is my code:
SpecialPoint.h
Code:
/******************************************************************************/
struct SpecialPoint : Game::Obj
{
Str pointID;
virtual void create(Game::ObjParams &obj);
SpecialPoint();
};
/******************************************************************************/
SpecialPoint.cpp
Code:
/******************************************************************************/
#include "stdafx.h"
#include "Main.h"
/******************************************************************************/
SpecialPoint::SpecialPoint()
{
pointID = "";
}
void SpecialPoint::create(Game::ObjParams &obj)
{
__super::create(obj);
//Detect parameters
if(Param *p = obj.findParam("pointID")) pointID = p->asStr();
}
/******************************************************************************/
What's the reason? How I can repair it?
(This post was last modified: 11-13-2010 08:18 PM by Ogniok.)
|
|
11-13-2010 08:02 PM |
|
Dandruff
Member
|
RE: Cannot instantiate abstract class
I'll look into it if i can
(This post was last modified: 11-13-2010 08:22 PM by Dandruff.)
|
|
11-13-2010 08:10 PM |
|
Dynad
Member
|
RE: Cannot instantiate abstract class
If you get only a linking problem then the code is fine without any errors. Only problem looks like it that you don't have a pointer extern to its class/struct. Or use forward declaration but i wouldn't use that cause its not very clean.
There is always evil somewhere, you just have to look for it properly.
|
|
11-13-2010 08:24 PM |
|
Dandruff
Member
|
RE: Cannot instantiate abstract class
I think i found it, but it may not be what you were looking for
Code:
struct SpecialPoint : Game::ObjParams
{
Str pointID;
virtual void create (Game::ObjParams &obj);
SpecialPoint();
};
I'm not sure if it works or not as i did not run it but it built without errors. Good luck!
(This post was last modified: 11-13-2010 08:49 PM by Dandruff.)
|
|
11-13-2010 08:44 PM |
|
Dynad
Member
|
RE: Cannot instantiate abstract class
(11-13-2010 08:44 PM)Dandruff Wrote: I think i found it, but it may not be what you were looking for
Code:
struct SpecialPoint : Game::ObjParams
{
Str pointID;
virtual void create (Game::ObjParams &obj);
SpecialPoint();
};
I'm not sure if it works or not as i did not run it but it built without errors. Good luck!
Obviously that wont work at all... cause ObjParams isn't a item/obj class to abstract from.
There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 11-13-2010 08:53 PM by Dynad.)
|
|
11-13-2010 08:52 PM |
|
Dandruff
Member
|
RE: Cannot instantiate abstract class
lol, knew something was amidst..
But its ok! Dandruff will try again...
|
|
11-13-2010 09:03 PM |
|
Driklyn
Member
|
RE: Cannot instantiate abstract class
Did you look at "EsenthelEngineSDK\Tutorials\Source\Advanced\4 - Demos, Game Basics\Game Basics\09 - Extending Game Object Class" tutorial? You're missing required methods.
|
|
11-13-2010 09:26 PM |
|
Ogniok
Member
|
RE: Cannot instantiate abstract class
Yeah. I have forgotten. Now it works, thanks.
|
|
11-13-2010 10:30 PM |
|