I just tried that but now it is saying that i am re-declaring inventory.
EDIT: That is when i tried yewbie's solution.
yewbies solution will work. It is putting the inventory variable in the global namepsace. The reason it fails is because you still declare it in main, you can only declare it once. Either in main, or in the global namespace.
The preferred way to do it is with parameter passing: gameloop(std::vector<> inventory) I recommend you look into it. It makes things much easier once you move to multiple headers where using the global namepsace like this become unmanageable.
The argument error is because you're still doing gameloop(inventory);
but your gameloop declaration is still gameloop() <- no arguments