Getting an incompatible pointer type error...
Here is my compile error:
[philip@mandrake Chapter3]$ gcc first.c -o first `gtk-config --cflags` `gtk-config --libs`
first.c: In function `main':
first.c:46: warning: passing arg 4 of `gtk_signal_connect_object' from incompatible pointer type
first.c:51: warning: passing arg 4 of `gtk_signal_connect_object' from incompatible pointer type
first.c:57: warning: passing arg 4 of `gtk_signal_connect_object' from incompatible pointer type
first.c:62: warning: passing arg 4 of `gtk_signal_connect_object' from incompatible pointer type
first.c:80:1: warning: no newline at end of file
/tmp/ccLnVwxD.o: In function `Update':
/tmp/ccLnVwxD.o(.text+0x2d): undefined reference to `strcopy'
collect2: ld returned 1 exit status
here is the code:
---------------------------------------------------------------------------------
#include<stdio.h>
#include<time.h>
#include<gtk/gtk.h>
void Update (GtkWidget *widget, char *timestr)
{
time_t timeval;
timeval = time( NULL );
strcopy (timestr, ctime( &timeval));
}
void PrintAndExit(GtkWidget *widget, char timestr[][26])
{
int i;
for (i = 0; i < 4; i++)
printf("timestr[%d] is %s", i, timestr[i]);
gtk_main_quit();
}
int main(int argc, char *argv[])
{
GtkWidget *window, *box, *button;
static char times[4][26] = {"Unset\n", "Unset\n", "Unset\n", "Unset\n"};
gtk_set_locale();
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(PrintAndExit), times);
gtk_window_set_title (GTK_WINDOW (window), "Signals 1");
gtk_container_border_width (GTK_CONTAINER (window), 0);
box = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box);
button = gtk_button_new_with_label ("Update 0");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (Update), ×[0]);
gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
button = gtk_button_new_with_label ("Update 1");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (Update), ×[1]);
gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
button = gtk_button_new_with_label ("Update 2");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (Update), ×[2]);
gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
button = gtk_button_new_with_label ("Update 3");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (Update), ×[3]);
gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
gtk_widget_show_all(window);
gtk_main();
return (0);
}
------end of code--------------------------------------------
I thought maybe that I wasnt declaring times as a pointer but that had nothing to do with the error... Anyone know why I might be getting this error?
|