You cant. The whole point of a global variable is that it is valid in the whole code, and doesnt belong to a function. If you declare a variable inside a function, it is always a local variable inside that function (I dont know anyting, so i could be wrong, but i dont think so)
I dont completly understand what you're trying to do. If you want a global variable, simply declare it outside a function (normally after the include's and "using namespace std;" statements), and you can use it in every single function.
If you want to avoid using global variables, you could use pointers
I think he is worried about the common anti-global-variable sentiment.
There is nothing wrong with using a global variable --if your variable needs global scope.
Silly things like "never use globals" and the like are nonsense. The correct way to think about it is to place things in the appropriate scope.
No one complains about functions like printf() or classes (ie "variables") like cout being placed in a global scope. Why? Because that is where they are useful. (Ok, ok, some people complain about it, but most of them know enough about it that it is almost always reduced to academic banter.)
In short: for things that need to have global scope, use global variables/functions/etc. That is, if you need to access a value in a global context, that value should have global scope.
For things that don't need global scope, use namespaces/local blocks/etc.
Program options are an excellent choice for making a global object. By definition, the options affect the operation of the entire program --and hence, global access is required.
Purists who think you should pass such things around as routine arguments are the same people who like playing with monads and who think that Schrödinger's cat is doing exactly what they think he is, a priori. In real business situations, such thinking is a money pit: it wastes time and complicates software design --it is a disservice to your employer/teammates/whatever.
I think if your looking at global variables you should consider an alternative design solution. Build a singleton class called "Configuration" etc and store them in that. That way you can validate the usage and assignment of these variables etc. Functionality not offered with global vars.