Creating multiple timers with ITimer class

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
kushagra
Posts: 40
Joined: Sun Dec 04, 2005 10:18 am

Creating multiple timers with ITimer class

Post by kushagra »

The class is abstract
How can i create a number of virtual timers
like
class b
{
class a
{
----> ITimer timer;

}o2[30];
}
object;

object.o2[0].timer.setTime(0);
object.o2[0].timer.start();
..
.
.
.
and so on

Now the error is shown and the line (---->) shown above that ITimer is an abstract class

error:
cannot instantiate abstract class
hybrid

Post by hybrid »

Use CTImer. All classes prefixed by 'I' are interfaces, and thus abstract. You have to use an implementation of this interface, or provide one on your own to create objects.
kushagra
Posts: 40
Joined: Sun Dec 04, 2005 10:18 am

Post by kushagra »

I included ctimer.h

and created object CTimer timer;
then timer.setTime(0);
then timer.start(0);


errors

main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl irr::os::Timer::initTimer(void)" (?initTimer@Timer@os@irr@@SAXXZ) referenced in function "public: __thiscall irr::CTimer::CTimer(void)" (??0CTimer@irr@@QAE@XZ)
main.obj : error LNK2019: unresolved external symbol "public: static unsigned int __cdecl irr::os::Timer::getRealTime(void)" (?getRealTime@Timer@os@irr@@SAIXZ) referenced in function "public: virtual unsigned int __thiscall irr::CTimer::getRealTime(void)" (?getRealTime@CTimer@irr@@UAEIXZ)
main.obj : error LNK2019: unresolved external symbol "public: static unsigned int __cdecl irr::os::Timer::getTime(void)" (?getTime@Timer@os@irr@@SAIXZ) referenced in function "public: virtual unsigned int __thiscall irr::CTimer::getTime(void)" (?getTime@CTimer@irr@@UAEIXZ)
main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl irr::os::Timer::setTime(unsigned int)" (?setTime@Timer@os@irr@@SAXI@Z) referenced in function "public: virtual void __thiscall irr::CTimer::setTime(unsigned int)" (?setTime@CTimer@irr@@UAEXI@Z)
main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl irr::os::Timer::stopTimer(void)" (?stopTimer@Timer@os@irr@@SAXXZ) referenced in function "public: virtual void __thiscall irr::CTimer::stop(void)" (?stop@CTimer@irr@@UAEXXZ)
main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl irr::os::Timer::startTimer(void)" (?startTimer@Timer@os@irr@@SAXXZ) referenced in function "public: virtual void __thiscall irr::CTimer::start(void)" (?start@CTimer@irr@@UAEXXZ)
main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl irr::os::Timer::setSpeed(float)" (?setSpeed@Timer@os@irr@@SAXM@Z) referenced in function "public: virtual void __thiscall irr::CTimer::setSpeed(float)" (?setSpeed@CTimer@irr@@UAEXM@Z)
main.obj : error LNK2019: unresolved external symbol "public: static float __cdecl irr::os::Timer::getSpeed(void)" (?getSpeed@Timer@os@irr@@SAMXZ) referenced in function "public: virtual float __thiscall irr::CTimer::getSpeed(void)" (?getSpeed@CTimer@irr@@UAEMXZ)
main.obj : error LNK2019: unresolved external symbol "public: static bool __cdecl irr::os::Timer::isStopped(void)" (?isStopped@Timer@os@irr@@SA_NXZ) referenced in function "public: virtual bool __thiscall irr::CTimer::isStopped(void)" (?isStopped@CTimer@irr@@UAE_NXZ)
main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl irr::os::Timer::tick(void)" (?tick@Timer@os@irr@@SAXXZ) referenced in function "public: virtual void __thiscall irr::CTimer::tick(void)" (?tick@CTimer@irr@@UAEXXZ)
..\..\bin\Win32-VisualStudio\TerrainRendering.exe : fatal error LNK1120: 10 unresolved externals
Guest

I have done a simple thing

Post by Guest »

1. ITimer* timer;
2. timer->setTime(0);
3. timer->start();

why the application crashes at point 2 and 3;
when i comment point 2 and 3 application works fine

works fine when commented
1. ITimer* timer;
2. //timer->setTime(0);
3. //timer->start();

what is the prob in creating a timer like this and in point 2 and 3
Post Reply