Using XFixes in an application

Philip Van Hoof spamfrommailing at freax.org
Tue Dec 28 13:23:25 PST 2004


can somebody point me to what I am doing wrong here. It seems that the
linker can't find FixesQueryExtension and FixesSelectSelectionInput

code and stuff below


$ cat configure.ac
AC_PREREQ(2.52)
AC_INIT(src/clipman.c)
AM_INIT_AUTOMAKE(clipman, 0.1)
AM_CONFIG_HEADER(src/config.h)
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"

AM_MAINTAINER_MODE
AC_PROG_CC
AC_PROG_CXX
AC_ISC_POSIX
AC_HEADER_STDC

PKG_CHECK_MODULES(CLIPMAN, xfixes, have_xfixes=true, have_xfixes=false)
AC_SUBST(CLIPMAN_CFLAGS)
AC_SUBST(CLIPMAN_LIBS)

AC_OUTPUT([
Makefile
src/Makefile
])
$

This is shown at the configure-stage:

checking CLIPMAN_CFLAGS... -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API
-I/usr/X11R6/include
checking CLIPMAN_LIBS... -L/usr/X11R6/lib -lXfixes -lX11

$ cat /usr/lib/pkgconfig/xfixes.pc
prefix=/usr/X11R6
exec_prefix=/usr/X11R6/bin
libdir=/usr/X11R6/lib
includedir=/usr/X11R6/include

Name: Xfixes
Description: X Fixes Library
Version: 3.0.0
Cflags: -I${includedir} -I/usr/X11R6/include -DXTHREADS  -D_REENTRANT
-DXUSE_MTSAFE_API
Libs: -L${libdir} -lXfixes -L/usr/X11R6/lib -lX11
$


$ cat Makefile.am
SUBDIRS = src
$ cat src/Makefile.am

INCLUDES = $(CLIPMAN_CFLAGS)

bin_PROGRAMS = clipman

clipman_SOURCES = \
        clipman.c

clipman_LDADD = $(CLIPMAN_LIBS)

$ cat src/clipman.c
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xfixes.h>
#include <stdio.h>


int main (int argc, char **argv)
{
        char *display_name = NULL;
        Display *display;
        int screen_num;
        Screen *screen_ptr;
        int ignore=0, xfixes_event_base=0;
        Atom atom;
        XEvent report;

        if ((display = XOpenDisplay (display_name)) == NULL) {
                (void) fprintf (stderr, "%s: cannot connect to X server
%s\n", argv[0], XDisplayName(display_name));
                return -1;
        }

        screen_num = DefaultScreen (display);
        screen_ptr = DefaultScreenOfDisplay (display);

        atom = XInternAtom (display, "CLIPBOARD", 0);

        FixesQueryExtension (display, &xfixes_event_base, &ignore);

        FixesSelectSelectionInput (display,
                RootWindow(display, screen_num),
                atom,
                XFixesSetSelectionOwnerNotifyMask |
                XFixesSelectionWindowDestroyNotifyMask |
                XFixesSelectionClientCloseNotifyMask);


        while (1)  {
                XNextEvent (display, &report);
                switch  (report.type) {
                default:
                        printf ("An X event happened\n");
                break;
                }
        }

        XCloseDisplay (display);
        return 0;
}
$

[freax at lort test]$ make
Making all in src
make[1]: Entering directory `/home/freax/test/src'
make  all-am
make[2]: Entering directory `/home/freax/test/src'
ccache distcc gcc33  -g -O2   -o clipman  clipman.o -L/opt/fdo/lib
-lXfixes -lX11 -ldl
clipman.o(.text+0x50): In function `main':
/home/freax/test/src/clipman.c:29: undefined reference to
`FixesQueryExtension'
clipman.o(.text+0x69):/home/freax/test/src/clipman.c:31: undefined
reference to `FixesSelectSelectionInput'
collect2: ld returned 1 exit status
distcc[10437] ERROR: compile (null) on localhost failed
make[2]: *** [clipman] Error 1
make[2]: Leaving directory `/home/freax/test/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/freax/test/src'
make: *** [all-recursive] Error 1
[freax at lort test]$

-- 
Philip Van Hoof, Software Developer @ Cronos
home: me at freax dot org
gnome: pvanhoof at gnome dot org
work: philip dot vanhoof at cronos dot be
junk: philip dot vanhoof at gmail dot com
http://www.freax.be, http://www.freax.eu.org




More information about the xorg mailing list