help compiling a program using Xlib

nutrina999@yahoo.com
Sat Nov 8 14:31:00 GMT 2003


   I tried to compile a simple program that uses Xlib,
but I get some error messages:

This is the program I tried to compile:


#include <X11/Xlib.h> 
#include <assert.h>   
#include <unistd.h>   

#define NIL (0)       

main()
{
 Display *dpy = XOpenDisplay(NIL);
 assert(dpy);
 Window w = XCreateWindow(dpy, DefaultRootWindow(dpy),
0, 0, 200, 100, 0, CopyFromParent, CopyFromParent,
CopyFromParent,  NIL, 0);
  XMapWindow(dpy, w);
  XFlush(dpy);
} 


The error messages are the following:
/tmp/ccf3zuyZ.o(.text+0x16): In function `main':
: undefined reference to `XOpenDisplay'
/tmp/ccf3zuyZ.o(.text+0x79): In function `main':
: undefined reference to `XCreateWindow'
/tmp/ccf3zuyZ.o(.text+0x8d): In function `main':
: undefined reference to `XMapWindow'
/tmp/ccf3zuyZ.o(.text+0x9b): In function `main':
: undefined reference to `XFlush'
/tmp/ccf3zuyZ.o(.eh_frame+0x11): undefined reference
to `__gxx_personality_v0'
collect2: ld returned 1 exit status 


Do explicitly have to include some libraries for the
linker? Please help me...



__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de



More information about the Gcc-help mailing list