SDL_Texture - Incomplete type

a day ago I installed the SDL2 library. This is not yet in Debian Wheezy, so I used the configure, make, make install commands.

In the end, when I try to use SDL_Texture, I get this error:

 error: forward declaration of 'SDL_Texture {aka struct SDL_Texture}' invalid use of incomplete type 'SDL_Texture {aka struct SDL_Texture}' 

After searching for the ad, all I found was two lines in SDL_render.h:

 struct SDL_Texture; typedef struct SDL_Texture SDL_Texture; 

No definition at all. I think my SDL_sysrender.h file is missing from my installation. This is in the source code that I downloaded, but not in the SDL2 include path.

Where should the problem be? Do I need to use any flag for the configuration file? Thank you for your help.

+8
c ++ linux debian sdl-2
source share
1 answer

There is nothing wrong with your installation. SDL_Texture is an opaque type by design (that is, intended for internal use by SDL2 only), you can "pass it" as a pointer, but you cannot access the internal elements (or create SDL_Texture yourself, for example by making malloc because you don’t know structure size). If you stick

 SDL_Texture *blah; 

and pass them into the SDL2 function, you should be fine.

SDL_sysrender.h is the internal header, which, as you mentioned, actually defines the SDL_Texture for internal library consumption.

+11
source share

All Articles