declarations in libraries

I got an error when I tried to declare it at the top of the header file

Those statements declare and initialize the variables. You need to declare them in the header file and initialize them in the source file if you want to share them.