need help with compiling with GTK+2.0 (updated)
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > need help with compiling with GTK+2.0 (updated)




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

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


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-17-04 12:45 AM

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






[ Post a follow-up to this message ]



    Re: need help with compiling with GTK+2.0 (updated)  
Christopher Nehren


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-17-04 12:45 AM

-----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.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:00 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register