Acces violation error when using GetTickCount in class pointer
I made a FPS class, which is used in my app by making a pointer to the class (CFPSClass* g_classPointerFPS)
But the returnFPS function of the class uses GetTickCount(); Now when I access the FPS class by using the pointer I get an Access violation error. When I don''t make it a pointer it works though (so instead of CFPSClass* g_classPointerFPS you get CFPSClass g_classFPS)
Is there a way to use GetTickCount() in a pointer class? I really need it to be a pointer :S
Thanks in advance!
problem is not with gettickcount, but with your class. are you allocating an instance of it with new at some point?
Since you probably are only going to ever have one instance of that class, you probably don''t need a pointer, but if you insist, make sure it looks like
and not
CFPSClass* g_classPointerFPS = new CFPSClass;// do stuffg_classPointerFPS->returnFPS();// do more stuffdelete g_classPointerFPS;
and not
CFPSClass* g_classPointerFPS;// do stuffg_classPointerFPS->returnFPS();// do more stuff
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement