Using timer interrupts in a library

I don't really want to because you shouldn't be including .cpp files.

Compilation units (things that are directly compiled) are .cpp files. They should include .h files which contain headers (hence the .h suffix) for other things which might be implemented elsewhere.

For a .cpp file to include another .cpp file is strange. Why not just put all the code in one file? Or if not, let the compiler compile both of them for you.

mattallen37:
Why does RCXIR.h get included multiple times?

Shouldn't the

#ifndef RCXIR_h

#define RCXIR_h


code protect against that?

You can't prevent the compiler from including an .h file multiple times. You can however avoid multiple definitions of its contents in the same compilation unit by using the #ifdef guard.

IOW, the #ifdef guard does protects against multiple inclusions, but not in the sense that it prevents the compiler from reading and parsing the file. Instead it prevents "double compilations" of a .h file in the context of a compilation unit (i.e. cpp file).