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

Re: Problem with: #include <X11/Xlib.h>



Kevin B. McCarty wrote:
gustavo halperin wrote:

I have a code that include the file "/usr/include/X11/Xlib.h", but when I try to compile I receive the parser error, see below:
In file included from cube.cpp:32:
/usr/include/X11/Xlib.h: In function `char* XSetOMValues(_XOM*, ...)':
/usr/include/X11/Xlib.h:3578: error: parse error before `(' token
/usr/include/X11/Xlib.h: In function `char* XGetOMValues(_XOM*, ...)':
/usr/include/X11/Xlib.h:3583: error: parse error before `(' token
..............

How I can resolve this problem,

I assume that you are using the Xlib.h from the Sid or Etch libx11-dev
package, since it has definitions for the functions XSetOMValues() and
XGetOMValues() near the line numbers printed in the compiler error.
(When reporting error messages in the future, please specify whether you
are using Sarge, Etch or Sid.)

It looks to me like the compiler is complaining about the _X_SENTINEL(0)
in this code in Xlib.h:

extern char *XSetOMValues(
    XOM                 /* om */,
    ...
) _X_SENTINEL(0);                  // <--- Line 3578

extern char *XGetOMValues(
    XOM                 /* om */,
    ...
) _X_SENTINEL(0);                  // <--- Line 3583


The _X_SENTINEL macro is defined in /usr/include/X11/Xfuncproto.h -- try
installing the latest version of the x11proto-core-dev package that
supplies this file.  (Should be version 7.0.4-3 in Sid or Etch.)
OK, I'm using Debian Sarge version, but my X is Xorg from "www.backports.org/backports.org/" version 6.9..... . This unofficial APT repository unfortunately haven't the x11proto-core-dev package, but the file /usr/include/X11/Xfuncproto.h is there but without the "_X_SENTINEL" definition.
Here is another possibility if the above suggestion doesn't work.  The
definition of _X_SENTINEL includes the GNU C extension of the
"__sentinel__" attribute, but only when __GNUC__ is defined and >= 4.
Is it possible that you are using an older compiler that doesn't
recognize __sentinel__, but for some reason your build has defined
__GNUC__ to have a value of 4 or greater anyway?
I have installed the gcc version 3.3.5.
After you mail I searched for the word "__sentinel__" in "www.google.com/linux" and I find the next solution from "http://www.mail-archive.com/debutant@mandrivalinux.org/msg03457.html"; : Just add the below code to the beginning of the file /usr/include/X11/Xlib.h"

	/* _X_SENTINEL BS */
	#if defined(__GNUC__) && (__GNUC__ >= 4)
	# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x)))

# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))

	#else
	# define _X_SENTINEL(x)
	# define _X_ATTRIBUTE_PRINTF(x,y)
	#endif /* GNUC >= 4 */


Now, the compilation success, and also the executable work fine. Do you think that my problem can be considered a bug from "www.backports.org/backports.org/" ? Therefore inform to they about ? And do you think that the fix is OK ?

 Thanks a lot for you help,
          Gustavo
Let the list know if these suggestions don't help.  It might also be
helpful if you posted the problematic file "cube.cpp".

regards,
--
I'm thinking.                | \\  l\\l_ //    |
   _              _         |  \\/ `/  `.|    |
 /~\\   \        //~\       | Y |   |   ||  Y |
 |  \\   \      //  |       |  \|   |   |\ /  |
 [   ||        ||   ]       \   |  o|o  | >  /
] Y  ||        ||  Y [       \___\_--_ /_/__/
|  \_|l,------.l|_/  |       /.-\(____) /--.\
|   >'          `<   |       `--(______)----'
\  (/~`--____--'~\)  /           U// U / \
 `-_>-__________-<_-'            / \  / /|
     /(_#(__)#_)\               ( .) / / ]
     \___/__\___/                `.`' /   [
      /__`--'__\                  |`-'    |
   /\(__,>-~~ __)                 |       |__
/\//\\(  `--~~ )                 _l       |--:.
'\/  <^\      /^>               |  `   (  <   \\
     _\ >-__-< /_             ,-\  ,-~~->. \   `:.___,/
    (___\    /___)           (____/    (____)    `---'



Reply to: