RE: multiple declaration error




> -----Original Message-----
> From: gtk-app-devel-list-bounces gnome org
> [mailto:gtk-app-devel-list-bounces gnome org]On Behalf Of Inguva
> Rajasekhar
> 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.

Nathan
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]