This is normally done using included header file and an "extern" declaration in it. In one of the file, you should also define this variable.
This is explained, for example, here:
http://www.geeksforgeeks.org/understanding-extern-keyword-in-c[
^].
You need to understand the background of separate compilation; what the compiler does and what the linker does.
With C++, it would be a good idea to have everything in classes (or enumeration types). To certain extent, this is a matter of personal taste.
—SA