cannot instantiate abstract class

Hi Everyone,

When I try to compile a project, I get these errors:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Compiling...
GMiniGolfApp.cpp
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\cfollowanimator.h(23) : warning C4305: 'initializing' : truncation from 'double' to 'irr::f32'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\cfollowanimator.h(23) : warning C4305: 'initializing' : truncation from 'double' to 'irr::f32'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(84) : error C2259: 'CWorldEditorGUI' : cannot instantiate abstract class
        due to following members:
        'bool irr::IEventReceiver::OnEvent(const irr::SEvent &)' : is abstract
        c:\irrlicht-1.4\include\ieventreceiver.h(256) : see declaration of 'irr::IEventReceiver::OnEvent'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(92) : error C2259: 'irr::scene::CBulletAnimatorManager' : cannot instantiate abstract class
        due to following members:
        'irr::u32 irr::scene::ISceneNodeAnimatorFactory::getCreatableSceneNodeAnimatorTypeCount(void) const' : is abstract
        c:\irrlicht-1.4\include\iscenenodeanimatorfactory.h(48) : see declaration of 'irr::scene::ISceneNodeAnimatorFactory::getCreatableSceneNodeAnimatorTypeCount'
        'irr::scene::ESCENE_NODE_ANIMATOR_TYPE irr::scene::ISceneNodeAnimatorFactory::getCreateableSceneNodeAnimatorType(irr::u32) const' : is abstract
        c:\irrlicht-1.4\include\iscenenodeanimatorfactory.h(53) : see declaration of 'irr::scene::ISceneNodeAnimatorFactory::getCreateableSceneNodeAnimatorType'
        'const irr::c8 *irr::scene::ISceneNodeAnimatorFactory::getCreateableSceneNodeAnimatorTypeName(irr::scene::ESCENE_NODE_ANIMATOR_TYPE) const' : is abstract
        c:\irrlicht-1.4\include\iscenenodeanimatorfactory.h(63) : see declaration of 'irr::scene::ISceneNodeAnimatorFactory::getCreateableSceneNodeAnimatorTypeName'
        'const irr::c8 *irr::scene::ISceneNodeAnimatorFactory::getCreateableSceneNodeAnimatorTypeName(irr::u32) const' : is abstract
        c:\irrlicht-1.4\include\iscenenodeanimatorfactory.h(58) : see declaration of 'irr::scene::ISceneNodeAnimatorFactory::getCreateableSceneNodeAnimatorTypeName'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(116) : warning C4305: 'argument' : truncation from 'double' to 'irr::f32'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(116) : warning C4305: 'argument' : truncation from 'double' to 'irr::f32'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(117) : warning C4305: 'argument' : truncation from 'double' to 'irr::f32'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(117) : warning C4305: 'argument' : truncation from 'double' to 'irr::f32'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(117) : warning C4305: 'argument' : truncation from 'double' to 'irr::f32'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(201) : warning C4244: 'argument' : conversion from 'const double' to 'irr::f32', possible loss of data
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(206) : warning C4244: 'argument' : conversion from 'const double' to 'irr::f32', possible loss of data
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(329) : warning C4244: 'argument' : conversion from 'int' to 'irr::f32', possible loss of data
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(329) : warning C4244: 'argument' : conversion from 'int' to 'irr::f32', possible loss of data
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(330) : warning C4244: 'argument' : conversion from 'int' to 'irr::f32', possible loss of data
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(330) : warning C4244: 'argument' : conversion from 'int' to 'irr::f32', possible loss of data
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(341) : warning C4305: '=' : truncation from 'double' to 'irr::f32'
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\gminigolfapp.cpp(343) : warning C4305: '=' : truncation from 'double' to 'irr::f32'
main.cpp
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\main.cpp(8) : error C2259: 'GMiniGolfApp' : cannot instantiate abstract class
        due to following members:
        'bool irr::IEventReceiver::OnEvent(const irr::SEvent &)' : is abstract
        c:\irrlicht-1.4\include\ieventreceiver.h(256) : see declaration of 'irr::IEventReceiver::OnEvent'
CWorldEditorGUI.cpp
c:\documents and settings\******\mijn documenten\visual studio 2008\projects\game\game\cworldeditorgui.cpp(268) : error C2440: 'initializing' : cannot convert from 'irr::core::list<T>::ConstIterator' to 'irr::core::list<T>::Iterator'
        with
        [
            T=irr::scene::ISceneNode *
        ]
        No constructor could take the source type, or constructor overload resolution was ambiguous
Generating Code...
Build log was saved at "file://c:\Documents and Settings\*****\Mijn documenten\Visual Studio 2008\Projects\game\game\Debug\BuildLog.htm"
game - 4 error(s), 15 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


It's about this project: http://www.mediafire.com/?7plwc9yyyhb
A Irrlicht(rendering engine)/Bullet(Physics engine) wrapper.

Can someone please help?

You better post the code segment to see it how it is written.

In simple terms, an abstract class has pure virtual function in it and it must be overridden (ie, defined) by its derived class, hence an abstract base class can not be instantiated.

For example, if myAbstractClass has a pure virtual function, (like, virtual myFunction() = 0 ) then it must have a derived/child class which gives a definition for that pure virtual function and can be instantiated.
As name suggests, an abstract is a skeleton and does not have all the stuff it needs to hence it can not be instanciated and compiler would complain so.

Check it out in the code. Good luck :)
and it must be defined derived by a child
Topic archived. No new replies allowed.