trying to make a library "multiple definition of '#var'

You cannot do anything in a .h file that allocates memory -- essentially, you may declare functions (but not define them), declare data as extern (but not as non-extern) and declare classes (and structs and enums and unions...)

okay:

// foo.h
extern int bar;
void f();
class foobar {
public:
  foo();
};

not okay:

int var;
void func() {
  var++;
}

Note that if a variable is declared extern, it must be defined somewhere else. "extern" means "the variable is defined somewhere else" so you'll just confuse the linker if you say it's somewhere else and then not have it at all. This also means you can't give a value to them because that's a definition, not a declaration.