When my project is really has great code structure, where using almost everywhere different datatypes, whether it makes sense to store many types (mostly static, eg structs) of data in a single header?
MyGameDataTypes.h for example. Where I declared the FCat, FDog, FElephant, etc...
struct FCat
{
... // much properties here
};
struct FDog
{
... // much properties here
};
struct FElephant
{
... // much properties here
};
/// AND MUCH MORE
Or for best way I must create every header individually for each my struct?
Cat.h
where struct FCat
Dog.h
where struct FDog
Elephant.h
where struct FElephant
etc...
Or there are better ways and this above is nonsense?
You can write several structures in the same .h file, and have only one file for all your animals structure. For example, a animals.h
file could contain FCat
FDog
and FElephant
. The most important thing is to have a coherence in your code. Having all your animals structure in one place is coherent, having a animal, a car and a building structure in the same file may not be.
Maybe it is already the case, but you should protect your header files from the multiple inclusion like that.