I continue to get this error when attempting to compile a bit of code I wrote up, with the location in the file being totally unhelpful. This uses gtk 2.0.
The following is what I receive at compile time:
charles@draton-generico:~/Documents/C89$ gcc -x c -ansi -g bahbahbah.c -o bahbahbah
pkg-config --cflags --libs gtk+-2.0bahbahbah.c: In function ‘main’:
bahbahbah.c:28:1: error: expected expression before ‘,’ token
The following is the code I am trying to compile:
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
void closure(void)
{
gtk_main_quit();
printf("gtk_main_quit() has been called.\n");
}
void main(int argc, char* argv[])
{
gboolean check = gtk_init_check(&argc, &argv);
if (check == FALSE)
{
printf("Failed to initialize toolkit.\nTerminating.\n");
exit(EXIT_FAILURE);
}
else
{
printf("Initialized toolkit.\n");
GtkWidget* main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title((GtkWindow*)main_window, "BLAH");
gtk_window_set_default_size((GtkWindow*)main_window, 700, 700);
g_signal_connect(main_window, "delete-event", closure, void);
gtk_widget_show(main_window);
printf("Window created, sleeping in gtk_main().\n");
gtk_main();
}
printf("Exiting.\n");
exit(EXIT_SUCCESS);
}
Please help. 🙁
Use
NULLreplacevoidin line 28.