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.

//-- Specs --//

Intel P3

gcc version 3.3.3 (cygwin special)

#gtk++ version

# Compiler name

# 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)
        rm -f $(OBJS)
        rm -f $(EXEC)

PHONY: clean

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

void Quit(GtkButton* was_clicked, gpointer user_data){
  g_print("Good bye");
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_widget_set_name(TopWidget,"Gtk++ One dos");
  gtk_widget_set_name(VBx,"vertical box");
  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

  //Processing loop
  return 0;

Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology. 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]