Re: Solaris compile problem: `X_' undeclared



Graham Leggett said:
> Hi all,
>
> I am getting the following compile error while trying to compile gtk+
> v2.6.7 under Solaris v2.8:
>
>  gcc -DHAVE_CONFIG_H -I. -I. -I../.. -DG_LOG_DOMAIN=\"Gdk\"
> -DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk -DG_DISABLE_DEPRECATED
> -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED
> -DG_DISABLE_CAST_CHECKS -threads -DXTHREADS
> -I/udd001/hoops/usr/include/glib-2.0
> -I/udd001/hoops/usr/lib/glib-2.0/include
> -I/udd001/hoops/usr/include/pango-1.0 -I/udd001/hoops/usr/include
> -I/udd001/hoops/usr/include/freetype2 -isystem /udd001/hoops/usr/include
> -mimpure-text -Wall -MT gdkasync.lo -MD -MP -MF .deps/gdkasync.Tpo -c
> gdkasync.c  -fPIC -DPIC -o .libs/gdkasync.o
> gdkasync.c: In function `_gdk_x11_send_client_message_async':
> gdkasync.c:257: error: `X_' undeclared (first use in this function)
> gdkasync.c:257: error: (Each undeclared identifier is reported only once
> gdkasync.c:257: error: for each function it appears in.)
> gdkasync.c:257: error: parse error before "GetInputFocus"
> gdkasync.c: In function `_gdk_x11_set_input_focus_safe':
> gdkasync.c:350: error: `X_' undeclared (first use in this function)
> gdkasync.c:350: error: parse error before "GetInputFocus"

Turns out the X11 header file /usr/include/X11/Xlibint.h contains the
following macro definition:

#define GetEmptyReq(name, req) \
        WORD64ALIGN\
        if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
            _XFlush(dpy);\
        req = (xReq *) (dpy->last_req = dpy->bufptr);\
        req->reqType = X_/**/name;\
        req->length = 1;\
        dpy->bufptr += SIZEOF(xReq);\
        dpy->request++

This causes the variable GetInputFocus to be rendered by the preprocessor
as "X_ GetInputFocus" instead of "X_GetInputFocus", and boom.

The kludge workaround is to add #define ANSICPP above the #include for
X11/Xlibint.h.

Not sure what the real fix is - there may be a Solaris patch for it, not
sure.

Regards,
Graham
--




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]