Valhalla Legends Forums Archive | C/C++ Programming | Xlib.h and Xlib problem

AuthorMessageTime
nslay
Console programming is terrible in Unix...or at least from what I can see so I decided to use curses or X libraries...I chose the latter so I can play with "widgets"
so anyways, I include the header Xlib.h so I can open a display using XOpenDisplay()
When I compile it g++ says (sorry I don't have it in front of me, let me paraphrase) "Hey you! Dumbass!  None of this stuff is declared so you can just die!" ... this isn't even function definitions its complaining about...it's complaining about things like type names.
Furthermore, I can't seem to find the library object to link it, I tried -llibX and -lXlib and in both instances it fails to find them

Currently I have Xorg libs installed
http://www.x.org/X11R6.8.2/doc/manindex3.html perhaps you can digest all this garbage and regurgitate the thing I'm missing

Oh and some other info...
I have the includes here
/usr/X11R6/include/X11/
the library objects here
/usr/X11R6/lib/  -- -l/usr/X11R6/lib/libraryname doesn't work either, ld still complains
June 17, 2005, 5:32 AM
NicoQwertyu
Try -lX11.
June 17, 2005, 5:58 PM
Kp
Although it's quite possible to design a GUI just with Xlib, it's generally going to be quite a bit of trouble.  The X protocol is fairly simple; for example, Xlib does not provide an equivalent to the Microsoft Windows "edit control," or similar building block entities.  If you're looking to design a complex application and don't want to build such objects from the ground up, you should look into using a toolkit such as GTK, which uses Xlib on your behalf to provide quite a few basic widgets. 

OTOH, getting used to GTK and its terrible (runtime -- ewwww!) type checking system can take a while.  If you want to write something unusual, like a screensaver daemon, you're better off sticking with Xlib directly.
June 18, 2005, 4:14 AM
nslay
[quote author=Kp link=topic=11867.msg116308#msg116308 date=1119068042]
Although it's quite possible to design a GUI just with Xlib, it's generally going to be quite a bit of trouble.  The X protocol is fairly simple; for example, Xlib does not provide an equivalent to the Microsoft Windows "edit control," or similar building block entities.  If you're looking to design a complex application and don't want to build such objects from the ground up, you should look into using a toolkit such as GTK, which uses Xlib on your behalf to provide quite a few basic widgets. 

OTOH, getting used to GTK and its terrible (runtime -- ewwww!) type checking system can take a while.  If you want to write something unusual, like a screensaver daemon, you're better off sticking with Xlib directly.
[/quote]

I don't like the look and feel of GTK "widgets"...how about Qt libraries? how are those?
June 18, 2005, 6:43 AM
Kp
I haven't used them, but I can tell you they're used extensively for the resource hog that is KDE. :)
June 18, 2005, 3:31 PM
St0rm.iD
I think Qt's licensing is pretty weird, too.

I use wxWidgets, but I've never used anything else. It's worked for me.
June 19, 2005, 5:25 PM

Search