Problems with simple examples



Hello Gtk+ world! I am wanting to learn gtk+ programming, and am having trouble getting the examples from the GGAD book (http://developer.gnome.org/doc/GGAD) working. I was able to run the 'Hello World' example in Appendix E more or less as described. Although a couple of warnings appeared:

Gtk-WARNING **: Failed to load module "libgail.so": libgail.so: cannot open shared object file: No such file or directory

Gtk-WARNING **: Failed to load module "libatk-bridge.so": libatk-bridge.so: cannot open shared object file: No such file or directory

(Obviously it's nothing so simple as them actually not being there).

But I found that with the GnomeCanvas example (listing on http://developer.gnome.org/doc/GGAD/z177.html) If I just copied and pasted the code, and built it with a similar command line, i.e.,

gcc canvoid.c -o base `pkg-config --cflags --libs gnomeui`

...it builds OK, produces the same two warnings, but hangs, or else goes:
*** glibc detected *** ./base: malloc(): memory corruption (fast): 0x08c81c30 ***
Segmentation fault
...if you jiggle the ellipse items around a lot.

However, if you replace:
#include <gnome.h>
with
#include <gtk/gtk.h>
#include <libgnomecanvas/libgnomecanvas.h>
and replace
gnome_init("canvas-example", "0.0", argc, argv);
with
gtk_init(&argc, &argv); ...you get rid of the warnings, and it no longer hangs.

However, the next thing I want to do is put the GnomeCanvas into the application framework from Hello World, and this seems to require that I use gnome.h and the gnomeui library. Thus, the app crashes.

Now I am just starting out with this, but I have trawled this mailing list and the Web in general for any references to similar problems, and can find none -- or at least none with answers. My personal suspicion is that I am falling victim to a vast and unacknowledged incompatibility problem owing to my system (Ubuntu 8.10) having components of both gtk+ 1.2 and 2.0 installed in various places. This does not help me find a solution though!

Can any initiates help me find my way through this minefield?
Cheers
   --Jasper




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]