Karel Adams
Posts: 4
Joined: Sat Oct 17, 2015 9:30 am

XCB development: library missing?

Sat Oct 17, 2015 9:40 am

I am developing my own application, using the XCB library on Raspbian. Mostly I follow the excellent tutorial on http://www.x.org/releases/X11R7.7/doc/l ... index.html All went well until I wanted to set the title on a window. Since adding the stanza

Code: Select all

  /* Set the title of the window */
  xcb_change_property (c, XCB_PROP_MODE_REPLACE, win,
                       WM_NAME, STRING, 8,
                       strlen (title), title);
it refuses to compile:

Code: Select all

source/C60_init_xcb: In function ‘main’:
source/C60_init_xcb:52:22: error: ‘WM_NAME’ undeclared (first use in this function)
source/C60_init_xcb:52:22: note: each undeclared identifier is reported only once for each function it appears in
source/C60_init_xcb:52:31: error: ‘STRING’ undeclared (first use in this function)
even though I have mentioned xcb_atom both as a header and as a compilation option.

Code: Select all

// general includes
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

// includes concerning graphical libraries & functions
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>

// includes concerning the Rpi and its GPIO interfaces

Code: Select all

gcc	-Wall \
	-o bin/myprog \
	-l xcb_atom \
	source/myprog_rpi.c
I have a suspicion there is a library missing but blimey if I could say which one. This is what I have installed:

Code: Select all

 dpkg --list | grep xcb
ii  libx11-xcb1:armhf                     2:1.5.0-1+deb7u2                        armhf        Xlib/XCB interface library
ii  libxcb-glx0:armhf                     1.8.1-2+deb7u1                          armhf        X C Binding, glx extension
ii  libxcb-render0:armhf                  1.8.1-2+deb7u1                          armhf        X C Binding, render extension
ii  libxcb-shape0:armhf                   1.8.1-2+deb7u1                          armhf        X C Binding, shape extension
ii  libxcb-shm0:armhf                     1.8.1-2+deb7u1                          armhf        X C Binding, shm extension
ii  libxcb-util0:armhf                    0.3.8-2                                 armhf        utility libraries for X C Binding -- atom, aux and event
ii  libxcb-util0-dev:armhf                0.3.8-2                                 armhf        utility libraries for X C Binding -- atom, aux and event
ii  libxcb-xfixes0:armhf                  1.8.1-2+deb7u1                          armhf        X C Binding, xfixes extension
ii  libxcb1:armhf                         1.8.1-2+deb7u1                          armhf        X C Binding
ii  libxcb1-dev:armhf                     1.8.1-2+deb7u1                          armhf        X C Binding, development files

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: XCB development: library missing?

Mon Nov 16, 2015 4:33 pm

I would say undeclared identifier is a compile time error so only affected by source types not libraries.

In fact appears to be a known issue with the example code: http://stackoverflow.com/questions/1106 ... ot-defined
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

Return to “Graphics programming”