Chris,

please see my answer below.

If you really need to define global variables in a header only library, you can define static members of a template class.  It's a fancy trick (not sure if it has a name).  Perhaps there are portablity issues with it.

I think it is not the same as defining a global static variable. Global static variable will have internal linkage and therefore be visible inside the compilation unit where defined only. Between the compilation units these variables will be different. IMO C++ like approach would be to introduce an anonymous namespace in header files and define global variables there. Defining static vars in the template class will result in a static variable per class template instantiation. Which is not exactly the same, as intended here.


Regards,
Ovanes