Unix Programming - need help with compiling with GTK+2.0 (updated)

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2004 > need help with compiling with GTK+2.0 (updated)





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author need help with compiling with GTK+2.0 (updated)
Call me Stupid

2004-12-16, 7:45 pm

Hi all,

I have this tiny tiny program, which (1) when compiled as ....

$> gcc -Wall -g example.c -o example `pkg-config --cflags --libs
gtk+-2.0` -lgtk -lgdk

.... compile well and then (2) when run, generates bus error at

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

(3) the same program works if GTK+1.2 is used instead of GTK+2.0

------- example.c ----------
#include <gtk-2.0/gtk/gtk.h>
int main( int argc,
char *argv[] )
{
GtkWidget *window;

gtk_init (&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
g_print ("Hello World\n");

gtk_widget_show (window);
gtk_main ();
return 0;
}



Thank you
Bek

Christopher Nehren

2004-12-16, 7:45 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2004-12-15, Call me Stupid scribbled these
curious markings:
> Hi all,
>
> I have this tiny tiny program, which (1) when compiled as ....
>
> $> gcc -Wall -g example.c -o example `pkg-config --cflags --libs
> gtk+-2.0` -lgtk -lgdk
>
> ... compile well and then (2) when run, generates bus error at
>
> window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>
> (3) the same program works if GTK+1.2 is used instead of GTK+2.0
>


I'm going to guess that you're using a binary package based-Linux (as
you gave no hint as to your operating platform in either of your posts),
since that seems to be The Cool Thing for Geeks that every geek uses if
they want to Be Cool, and because you use -lgtk and -lgdk which implies
non-versioned installations of the GTK+ libraries which assumes that
you'll only ever have one version of those libraries installed, which is
the assumption that many Linux distributions seem to be in the habit of
making (completely neglecting the existence of many fine GTK+ 1.x
applications that are much better than any GTK+ 2.x replacement, such as
XMMS)[1]. If this is incorrect, I'll ecstatically welcome a correction.

If this is the case, then did you perhaps install a version of the GTK+
libraries which are incompatible with your hardware architecture? This
is often the cause of 'illegal instruction' errors as you posted in your
previous post. If you compiled your libraries from source with the
proper compiler flags, then you wouldn't have this (and probably many
other (but I digress)) problem(s).

Do other applications linked against the same version of the GTK+ 2.x
libraries work? The sample application that you provided compiles and
runs fine for me (modulo the Lunixisms I described above), so it's
(probably) not a code issue. I'm running GTK+ 2.5.6.

1: Holy Unbounded Run-on, Batman!

Best Regards,
Christopher Nehren
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD8DBQFBv6Brk/ lo7zvzJioRAmteAKCplJiRjBRlxLgB6HNpt8KHEm
BLewCggMM2
bWV9DLKLJfYehSEVrXoQHEk=
=EMv9
-----END PGP SIGNATURE-----

--
I abhor a system designed for the "user", if that word is a coded
pejorative meaning "stupid and unsophisticated". -- Ken Thompson
If you ask the wrong questions, you get answers like "42" and "God".
Unix is user friendly. However, it isn't idiot friendly.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com