The second version is defined in the global namespace -- other .cpp files can get to it by declaring
extern int var;
and even if they don't do that, if someone else uses the same name in the global name space, you'll get a link error (multiply defined symbol).