Ok, the easiest way is to put the extern variable in a header file, and in
exactly one source file (.cpp), just define the same variable less the extern:
// foo.h#include <vector>class Foo{ // ...};// declarationextern std::vector<Foo> globalFoos;// foo.cpp#include "foo.h"// definitionstd::vector<Foo> globalFoos;
However, it should be noted that global variables are usually indicative of lack of design - or poor design. Usually there are far better alternatives.
Other notes:
Unless you have good reason, consider std::vector as the default container.
Prefer std::string instead of raw char arrays
Instead of commenting ally as Friend (0) or Foe(1), use a boolean:
bool ally;
Or an enum (I would prefer a boolean in this case, but for completeness)
enum State{ ALLIED, ENEMY, // could easily add neutral too, or "unknown"};