I have a vector in a header, like so:
extern std::vector g_vector;
In the associated cpp file I have this:
std::
Order of initialization of global values is not defined.
Read here about the static initialization fiasco.
When you declare Bar in a function - the g_vector will be initialized before, because its promised to be initialized before the program runs. If Bar is a global variable - then you have a problem.