[SOLVED] error: no member named 'x11' in 'SDL_SysWMinfo'

I’m trying to build an application using SDL2 on debian 11 using the the system-provided SDL2 headers and libraries.

When building (using clang++), I get this error:

error: no member named 'x11' in 'SDL_SysWMinfo'
    return (Aspect_Drawable) info.x11.window;
                             ~~~~ ^

The relevant lines of my source file are:

SDL_SysWMinfo info;
if(SDL_GetWindowWMInfo(mySdlWindow,&info)) {
         return (Aspect_Drawable) info.x11.window;

I can see that in SDL_syswm.h the x11 struct is surrounded by an #ifdef block, so I tried adding -DSDL_VIDEO_DRIVER_X11 to the compiler options, but no luck, I still get the same error.

Any help is appreciated.

Use info.info.x11.window

Unfortunately I don’t see the wik mentioning it.

Thanks. Now it works.