Re: multiple declaration error



On Wed, Feb 09, 2005 at 08:56:20AM -0600, Prewitt,  Nathan C ERDC-ITL-MS Contractor wrote:

  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.

I don't see how this scenario described has anything to do with a
"multiple definition" problem, why would it?
This is not applicable to the original question.

With the error given, it clearly was an object being passed to the
linker twice.

Note that declarations and definitions are not the same thing.

  -jkl



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