I need to malloc an array of SDL_Textures, but upon trying sizeof(SDL_Texture), gcc gives me the error error: invalid application of ‘sizeof’ to incomplete type ‘SDL_Texture’. I guess this means gcc doesn’t have access to the whole SDL_Texture struct definition, but only to a struct SDL_Texture; declaration somewhere in the <SDL/SDL.h> that is included in my source file. Is there a way to get access to the struct definition/its size?
Don’t do this. You should only ever let SDL create and destroy SDL_Textures. You should never need to allocate one yourself.
Are you wanting to allocate an array of pointers to SDL_Textures?
1 Like
Are you wanting to allocate an array of pointers to
SDL_Textures?
Ah yes, that is what I want, thanks.
1 Like