I have a bit of a problem with header's and cpp files, I started creating a little text based game and i wanted to make all the work more clearer by creating more files and separated files to each class (Player.cpp, Monster.cpp Entity etc..).
So I ended up with a lot of #include directive's in each cpp file (i haven't used headers yet).
I needed a the rand function so i added stdlib to each class, and iostream to player class and etc..
so i ended up with a lot of double and triple uses of the same library, what should i do to avoid it? is there any way to avoid it at all? (creating a separate class for random for example wont work because i need to add it to the classes as well any ways).
Thanks in advance!
EDIT: But if i have something like this?:
main.cpp -> Player.h -> stdlib.h
-> Monster.h -> stdlib.h
what can i do to make stdlib.h to be in all classes without warning or errors?
In other words, how can i create header's without including a lot of the same library in each with? (Player and Monster are different classes and they both need stdlib, what should i do to include just once that library?)