Google Answers Logo
View Question
 
Q: How to compile a gnome program ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: How to compile a gnome program
Category: Computers > Programming
Asked by: ga1000-ga
List Price: $10.00
Posted: 26 Apr 2003 22:06 PDT
Expires: 26 May 2003 22:06 PDT
Question ID: 196051
I tried to compile the following sample tutorial code on Red Hat 8.0, with 

>gcc test.c -o test1 `gnome-config --cflags --libs gnomeui`

The output is an error message "undefined reference to gtk_Widget_show".

Please advice how to solve this problem in order to produce an empty window.

I assume that RH 8.0 has all the gnome libraries. 

sample code is :

#include <gnome.h>

int main (int argc, char *argv[])
{
 GtkWidget *app;
 gnome_init("example","0.1",argc, argv);
 app=gnome_app_new("example","Window Title");
 gtk_Widget_show(app);
 gtk_main();
 return 0;
}
Answer  
Subject: Re: How to compile a gnome program
Answered By: eiffel-ga on 26 Apr 2003 22:49 PDT
Rated:5 out of 5 stars
 
Hi ga1000-ga,

Identifier names are case-sensitive in the C programming language, and
your error message is caused by a spurious uppercase letter.

If you change 'gtk_Widget_show' to 'gtk_widget_show' then your example
should work. I tried it on my RedHat 8.0 system and it produced an
empty window, as expected.

Note that you are not calling 'gtk_main_quit' in your example code. If
you launch your compiled example from the command-line (for example by
typing './test' in a console window) you will probably have to press
control-C to regain the command prompt (even after you have closed the
window of the example application). For a more complete introductory
example including a clean shutdown see "Hello World in GTK":
http://www.gtk.org/tutorial/ch-gettingstarted.html#SEC-HELLOWORLD

The 'gtk_widget_show' identifier is defined in file 'gtkwidget.c',
according to the Gnome Cross Reference search
http://cvs.gnome.org/lxr/ident?i=gtk_widget_show
which provides a handy way to find usage examples for any GTK
identifier.


Google search strategy:

gtk_Widget_show
://www.google.com/search?q=gtk_Widget_show

gtk tutorial
://www.google.com/search?q=gtk%20tutorial


Regards,
eiffel-ga

Request for Answer Clarification by ga1000-ga on 27 Apr 2003 00:45 PDT
Thank you for your answer. It works as you said.

Clarification of Answer by eiffel-ga on 28 Apr 2003 08:01 PDT
Glad it worked. Happy compiling!
ga1000-ga rated this answer:5 out of 5 stars

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy