// The timer
// The clock time when the timer started
// The ticks stored when the timer was paused
// The timer status
// The dot that will move around on the screen
// The X and Y offsets of the dot
int x, y;
// The velocity of the dot
int xVel, yVel;
// Initializes the variables
// Takes key presses and adjusts the dot's velocity
// Moves the dot
// Shows the dot on the screen
Thank you very much for the resource. Once I added extern both it worked but i'm a little bit confused. The link said:
"a const-qualified object at file scope" but this isn't an object. Now what I'm also confused about is what does that make the initialized variable? a definition or a declaration? Is this a keyword used for situations like this or is there something more?
Objects with the const specifier have internal linkage. So these definitions
//The screen attributes
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;
//The dimensions of the dot
const int DOT_WIDTH = 20;
const int DOT_HEIGHT = 20;
are visible only in translation units that contain this header.
There is no need to define them as external. You can simply include a header where they are defined in each translation unit. Or you can declare them as external but define them only in one module.
Nevermind I think i got it. Seems I misunderstood the concept of extern which merely makes the variable of external linkage but doesn't determine whether a variable is a definition or declaration. Thank you once again ne555.