I have to create a "Character" object into a "Game" class. Both have SDL2 included. "Game" class uses SDL for "SDL_BlitSurface" and "SDL_UpdateWindowSurface". "Character" class uses SDL for "SDL_Surface". Is there a way to avoid redundancy ? Will the compiler include SDL2 just once ?
Will the compiler include SDL2 just once?
If the included header has an include guard, then yes.
If the header contains any definitions, then it must have an include guard or else including it multiple times would make the program ill formed.
I didn't go through all headers of SDL, but I would assume that every one of them uses an include guard.
I included "SDL.h" in both Game.h and Character.h. Is it a problem for source health ?
I don't know what source health is. If
Game.h depends on definitions/declarations in
SDL.h, then it must include
Character.h depends on definitions/declarations in
SDL.h then it must include
SDL.h also. There is nothing wrong with that. It is quite typical.