Newbey Question



Hello GTK++ users!!
With the aid of "Teach yourself GTK++ Programming in 21 Days" from SAMS I have been able to write my first GTK++ program, as well as a small 'Makefile' to do the compilation. My question is not about the 'Makefile', but about the GTK++ program itself. Nevertheless, I have included the 'Makefile' code so that you can have a better understanding of what my problems is, and what my problem is, is that when I type make, I get a message saying:
****************
main.cpp:41: error: invalid conversion from 'void (*)(GtkButton*, void*)' to 'void(*)()'
****************

I know that this might be one of those dumb questions, but I really don't know enough GTK++ to even have an educated assesment of the problem. I want to reiterate that this is my first program, so please take it easy on me.

TIA
//-- Specs --//
#OS
WinXP

#Machine
Intel P3

#Compiler
gcc version 3.3.3 (cygwin special)

#gtk++ version
1.2.10

----------
#Makefile
~~~~~~~~~
# Compiler name
CC=g++

# Flagas
CFLAGS = -Wall -g -ansi `gtk-config --cflags`
LIBS = `gtk-config --libs`

# Variables
OBJS = main.o
EXEC = gtkOne
PROG = my_app

#Application name
my_app: $(OBJS)
	$(CC) $(LDLIBS) $(OBJS) -o $(EXEC)

main.o: main.cpp
	$(CC) $(CFLAGS) -c main.cpp

all: $(PROG)
clean:
	rm -f $(OBJS)
	rm -f $(EXEC)

PHONY: clean
--------


---- GTK++ PROGAM ---------
#include <gtk/gtk.h>

//Callbacks
void Quit(GtkButton* was_clicked, gpointer user_data){
  g_print("Good bye");
  gtk_main_quit();
}
int main(int argc, char *argv[]){
  //Declare the objects
  GtkWidget* TopWidget;
  GtkWidget* VBx;
  GtkWidget* Label;
  GtkWidget* Separator;
  GtkWidget* btnExit;

  //Initialize the environment
  gtk_init(&argc, &argv);

  //Create Widgets
  TopWidget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  VBx       = gtk_vbox_new(FALSE,0);
  Label     = gtk_label_new("Jamiil Abdullah Alkadir");
  Separator = gtk_hseparator_new();
  btnExit   = gtk_button_new_with_label("Exit");

  //Set attributs
  gtk_window_set_title(GTK_WINDOW(TopWidget), "Gtk++ One");
  gtk_window_set_policy(GTK_WINDOW(TopWidget), //which_window
                        FALSE, // allow_shrink
			 TRUE,  // allow_grow
			 TRUE); // auto_shrink

  gtk_container_set_border_width(GTK_CONTAINER(TopWidget),15);
  gtk_widget_set_name(TopWidget,"Gtk++ One dos");
  gtk_widget_set_name(VBx,"vertical box");
  gtk_widget_set_name(Label,"Label");
  gtk_widget_set_name(Separator, "Separator");
  gtk_widget_set_name(btnExit, "Exit");

  //Register CallBacks <<== **Here is the problem 8)
  gtk_signal_connect(GTK_OBJECT(btnExit), "clicked", Quit, NULL);

  //Define instance hirarchy (pack the widgets)
  gtk_container_add(GTK_CONTAINER(TopWidget), VBx);
  gtk_box_pack_start_defaults(GTK_BOX(VBx), Label);
  gtk_box_pack_start_defaults(GTK_BOX(VBx), Separator);
  gtk_box_pack_start_defaults(GTK_BOX(VBx), btnExit);

  //Show the Widgets
  gtk_widget_show_all(TopWidget);

  //Processing loop
  gtk_main();
  g_print("Bye/n");
  return 0;
}

_________________________________________________________________
Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*.




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