954,249 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

installing a library in gcc

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

libathos
Junior Poster in Training
50 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

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

griswolf
Veteran Poster
1,165 posts since Apr 2010
Reputation Points: 344
Solved Threads: 256
 

for one thing it doesnt recognise the xlib commands..

libathos
Junior Poster in Training
50 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

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!

JasonHippy
Master Poster
769 posts since Jan 2009
Reputation Points: 590
Solved Threads: 125
 

ok guys thx for help :)

libathos
Junior Poster in Training
50 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: