Including interrupt routine in library

I’m writing a library which sets up timer0 so that I can use my own implementation of millis() (note: I am not using Arduino code, only pure AVR C). Now, I’ve written a function which sets up timer and now I can’t figure out how do I include ISR routine inside a library. The code I need in lib is this:

ISR(TIMER0_COMPA_vect)  {
	
	//increment current time
	milliSeconds++;

}

milliSeconds variable is declared as volatile uint32_t and code which accesses variable is this:

uint32_t OpenDeck::rTimeMillis()	{
	
	//variable to hold time in ms since sketch is running
	uint32_t rTime;

	//disable interrupts during access to milliSeconds
	ATOMIC_BLOCK(ATOMIC_FORCEON) {
		
		rTime = milliSeconds;
		
	}

	return rTime;
	
}

And it doesn't work?

So what errors did you get?

MarkT: And it doesn't work?

So what errors did you get?

No, I'm getting error that milliSeconds is not declared in this scope.

No, I'm getting error that milliSeconds is not declared in this scope.

Well, I agree with the compiler.

Off to http://snippets-r-us.com with you.

Make sure that you're declaring milliSeconds in a more general scope (not inside any functions, or in your OpenDeck class) before you use it in any functions.