Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: C Code Error Help

2006-04-03 by heedaf

> > > > I'm getting the following error in CrossWorks
> > > > 
> > > >          "multiple definition of `clear'" 
> > > > 
> > > > when I try and run the following code.  Does anyone have any 
> > > > suggestions?
> > > > Thanks,
> > > > Dewayne
> > > > 
> > > > 
> > > > 
> > > > #define SAMPLE  double      /* define the type used for data 
> > > > samples */
> > > > 
> > > > 
> > > 
> /*************************************************************
> > > > *********
> > > > ******/
> > > > /* clear: zeroize a FIR delay 
> > > > line                                          */
> > > 
> /*************************************************************
> > > > *********
> > > > ******/
> > > > void clear(int ntaps, SAMPLE z[])      
> > > 
> > > <snip>
> > > 
> > > Make sure you have a function prototype somewhere before
> > > the function definition, and before you call it.  i.e.:
> > > 
> > > void clear(int, SAMPLE);
> > > 
> > 
> > 
> > Still doesn't work.  It will compile Ok but gives the above 
error.  
> > Does it have anyting to do with passing an array?  If so, what 
is 
> > the correct format?
> > 
> 
> Well, you really shouldn't try to pass the array.  Usually one 
would
> pass a pointer to the array.
> 
> It's also possible that clear is a name already used by CrossWorks
> somewhere.
> 
> When do you get the error?  Is it during compile, link, or debug?
> 
> Mike
>
*****************************************************
******************************************************
I put static in front of the function call and it will debug now.  
With my limited knowledge of C I'm not sure why this is the case.  I 
changed the function call name to ensure that it is an unique 
without any luck.  Any idea why static works?
Thanks for your help Mike,
Dewayne

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.