std::map<ALLEGRO_EVENT_TYPE,vector<GameEntity*>>* registered_events = NULL;
// ^^ Here
If you're using C++03, place a space between the highlighted > symbols. The compiler thinks it's a right-shift operation. It supposed to look like: ...<ALLEGRO_EVENT_TYPE, vector<GameEntity*> > ...
Did you try using "std::vector" instead of "vector"?
Or ALLEGRO_EVENT_TYPE* ?
Anyways: std::map<ALLEGRO_EVENT_TYPE,std::vector<GameEntity*>>* registered_events = NULL;
This will work anyways, because it's a POINTER, not a variable.
You can define values in the global scope anyways.
I used to do things like this in the global scope:
@EssGeEich this is not standard C++ (about assigning stuff in global scope). Perhaps you can do that with simple types, but a constructor of such a complicated object like map won't run in the global scope.
It's a std::map pointer, check it twice. And, as it is a pointer, you can assign NULL to it to make sure you know it's a invalid pointer. What i mean is, In the "Debug" mode (At least under MSVS) every variable's default value isn't 0 (NULL is 0). So if you don't assign 0 to it, it will be something like 0xcdcdcdcd or 0xfefefefe - and how would you check if a pointer is valid or not? The fastest way is to check if it's a 0 (0x0), but what if you get a 0xcdcdcdcd-like value? Is it valid or not? P.S.: Don't think about this post as a disrespectful reply.
You can initialise your pointer in your main, it doesn't make a difference, because it's still not standard C++ to initialise stuff outside a sequential function.
And actually, that's why there's something called static variables, through which you can use a single variable along the whole code (per se, global), and it's always initialised by the constructor of the object you're creating (without having to do it explicitly).
static variables is the legal solution to globalising objects with them being automatically initialised.