I am working on a text-based rpg, using C++ and I have some trouble with std::vectors. I've created a vector in my namespace called "Initialize" , in its header. In "Initialize.cpp" I add objects of the type "Items" to the vector using push_back.
I want to know how I can access the objects in my vector I've created in my namespace "Initialize" from my Item-class.
GetItemName(Diablo::Initialize::existingItems) //GetItemName returns the name of the object it receives. // This doesn't work since I have to include "Initialize.h" // which gives linker-errors.
The problem is that if I include "Initialize.h" to be able to access the vector defined in "Initialize.h", i'll get linker-errors since the the vector will be defined both in my "Initialize.h" and in my "Items.cpp".
How can I declare my vector so that I can easily access from other classes etc.?