Windows Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsWindows Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 21st, 2012, 02:55 PM
SunnySood SunnySood is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 1 SunnySood User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 53 sec
Reputation Power: 0
Cant compile GTK hello world program in cygwin

I have been trying to compile a simple gtk, C based program in cygwin and i've been googling all day but nothing works. I have downloaded all the appropriate packages but it seems that cygwin can see the gtk libraries. I am using windows 7 64 bit.

when I compile

#include <gtk/gtk.h>

/*call back function:
*/
static void hello( GtkWidget *widget,
gpointer data)
{
g_print("Hello world\n");
}

static gboolean delete_event(GtkWidget *widget,
Gdk *event,
gpointer data)
{

g_print("delete event occured\n");

/*change true to false and the main window will be
destroyed with a delete-event*/
return true;
}

/*Another call back function*/
static void destroy(GtkWidget *widget,
gpointer data)
{
gtk_main_quit();
}

int main(int argc, char *argv[])
{
/*GtkWidget is the storage type for widgets.
initialise window and button?*/
GtkWidget *window;
GtkWidget *button;

/*This is called in all GTK applications. Arguments
are parsed from the command line and are returned
to the application. */
gtk_init (&argc, &argv);

/*create a new window*/
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);


g_signal_connect(window,"delete-event",
G_CALLBACK(delete_event),
NULL);


g_signal_connect(window, "destroy",
G_CALLBACK(destory),
NULL);

/*Sets the border width of the window*/
gtk_container_set_border_width(GTK_CONTAINER(window), 20);

/*Creates a new button with the label "Hello World"*/
button = gtk_button_new_with_label("Hello World!");


g_signal_connect(button, "clicked",
G_CALLBACK(hello),
Null);


G_CALLBACK(gtk_window_destroy),
window);

g_container_add(GTK_CONTAINER(window), button);

/*final step - display newly created widget*/
gtk_widget_show(button);

/*display window*/
gtk_widget_show(window);

gtk_main();

reutrn 0;
}


with this in cygwin

$ gcc helloworldgtksteps.c -o helloworld `pkg-config --cflags --libs gtk+-2.0`


helloworldgtksteps.c:15:9: error: expected declaration specifiers or ‘...’ before ‘Gdk’
helloworldgtksteps.c: In function ‘delete_event’:
helloworldgtksteps.c:26:9: error: ‘true’ undeclared (first use in this function)
helloworldgtksteps.c:26:9: note: each undeclared identifier is reported only once for each function it appears in
helloworldgtksteps.c: In function ‘main’:
helloworldgtksteps.c:66:2: error: ‘destory’ undeclared (first use in this function)
helloworldgtksteps.c:79:2: error: ‘Null’ undeclared (first use in this function)
helloworldgtksteps.c:88:2: error: ‘gtk_window_destroy’ undeclared (first use in this function)
helloworldgtksteps.c:118:2: error: ‘reutrn’ undeclared (first use in this function)
helloworldgtksteps.c:118:9: error: expected ‘;’ before numeric constant

I think its to do with paths which i dont know how to configure. I have a system path set to C:\gtk\bin\ but thats it. I am totally lost and a total newb.

Side note:
when i try ./confirgure - i get no such file or directory. I have pkg-config and all the rest of the packages i need.

Cheers.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsWindows Help > Cant compile GTK hello world program in cygwin

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap