RE: multiple declaration error
- From: "Prewitt, Nathan C ERDC-ITL-MS Contractor" <Nathan C Prewitt erdc usace army mil>
- To: "Inguva Rajasekhar" <ringuva novell com>, "Aaron Yang" <porsche1904 yahoo com>
- Cc: gtk-app-devel-list gnome org, glade-users lists ximian com, gtk-list gnome org
- Subject: RE: multiple declaration error
- Date: Wed, 09 Feb 2005 14:58:39 -0000
> -----Original Message-----
> From: gtk-app-devel-list-bounces gnome org
> [mailto:gtk-app-devel-list-bounces gnome org]On Behalf Of Inguva
> Sent: Wednesday, February 09, 2005 4:01 AM
> To: Aaron Yang
> Cc: glade-users lists ximian com; gtk-app-devel-list gnome org;
> gtk-list gnome org
> Subject: Re: multiple declaration error
> > does anyone know why i get the following error even
> > though i've only declared the function once?
> Even though the function is declared only once, if it is defined
> twice then you are bound to get that error.
> - Check if the function draw_button_clicked() was defined twice.
> - Check your Makefile to see if the way the package is being built
> is sane or not.
You should have a prototype for the function in a header file
(callbacks.h). Then you should include the header file at the top of each
file that contains code that calls the function (at least callbacks.c and
main.c in your case). If you failed to include the header file, when the
compiler sees the function call, it assumes the function has some default
args and return value type. Then, when the functions is defined, if it does
not match the default, it says that the function was declared twice.
] [Thread Prev