Laterix
April 30th, 2007, 07:53 PM
I'm learning C and GTK+ programming and I have a problem with including more source files. I use Anjuta and libglade for UI. I use libglade glade_xml_signal_autoconnect function to bind callback functions to UI. Everything works as long as every function is in the same main.c file. But there are a lot of callbacks and I would like to put them in different file called main_window_callbacks.c and then include this file in main.c. I do this and include statement is exactly in the place where those functions were when they were in main.c. But this doesn't work.
Here is the beginning of my main.c
/* Created by Anjuta version 1.2.4a */
/* This file will not be overwritten */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gnome.h>
#include <glade/glade.h>
/* Global pointer to glade XML */
GladeXML *xml;
/* GTK (Glade) - User interface callbacks */
#include "main_window_callbacks.c"
one of my callbacks look like this (located in main_window_callbacks.c)
void
set_fullscreen (GtkWidget * widget, gpointer used_data)
{}
Now, when this function is in separated file, I get this compile error:
main_window_callbacks.c:3: error: expected ‘)’ before ‘*’ token
I'm confused.
Here is the beginning of my main.c
/* Created by Anjuta version 1.2.4a */
/* This file will not be overwritten */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gnome.h>
#include <glade/glade.h>
/* Global pointer to glade XML */
GladeXML *xml;
/* GTK (Glade) - User interface callbacks */
#include "main_window_callbacks.c"
one of my callbacks look like this (located in main_window_callbacks.c)
void
set_fullscreen (GtkWidget * widget, gpointer used_data)
{}
Now, when this function is in separated file, I get this compile error:
main_window_callbacks.c:3: error: expected ‘)’ before ‘*’ token
I'm confused.