• Advertisement
Sign in to follow this  

Global Timer

This topic is 4369 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay this is a real newbie C++ question but I need to ask it. I've got a global timer class I need to link. Now for my other global class I use a singleton and it works fine. However my g_DeltaTimer doesn't seem to work. It needs to be a global in a header with some defines. its set by the main game loop in main.cpp but needs to be accessed across the program. I tried put in "support.h" static unsigned long g_DeltaTimer; But its always Zero in another class when I call it. Please will someone tell me the simple solution so I can stop beating my head around in stupidity.

Share this post


Link to post
Share on other sites
Advertisement
That seems to generate a linking error. I'm not at machine atm but I'll paste error when I get home tonight.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kimau
...
I tried put in "support.h"
static unsigned long g_DeltaTimer;


That code will define a separate variable named g_DeltaTimer in every file support.h is included in.

If you follow what simon10k wrote, you will have a single variable accessible from any file that includes support.h.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement