• Welcome to Valhalla Legends Archive.
 

Xlib.h and Xlib problem

Started by nslay, June 17, 2005, 12:32 AM

Previous topic - Next topic

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


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.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

nslay

Quote from: Kp on June 17, 2005, 11:14 PM
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.

I don't like the look and feel of GTK "widgets"...how about Qt libraries? how are those?

Kp

I haven't used them, but I can tell you they're used extensively for the resource hog that is KDE. :)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Banana fanna fo fanna

I think Qt's licensing is pretty weird, too.

I use wxWidgets, but I've never used anything else. It's worked for me.