Can anyone tell me how can i install the xlib.h library in the gcc compiler of ubuntu?

I'm pretty sure it is already there. What makes you think it isn't?

for one thing it doesnt recognise the xlib commands..

1. Check your distros package manager and make sure you have the libx11-dev package installed (on debian based distros) OR libx11-devel (on Fedora/rpm based distros). This provides the basic headers that will allow you to create client programs using Xlib. The runtime binaries should already be installed. If you need the package, install it using one of your distros package management programs (aptitude, apt-get, yum....whatever!)

2. To include the headers in your programs use: #include <X11/Xlib.h> Finally and most importantly:
3. Use the '-l X11' option on the command-line to allow the linker to find the appropriate library and link your program.
e.g. gcc -o myprogram myprogram.c -l X11 That's all I can think of offhand. Hope that clears things up for you!