"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message news:<3F**************@jpl.nasa.gov>...
Andrew wrote:
I am receiving a multiple definition error from the linker
when I try to build a project I am working on.
The message states that the functions I that defined
within an external .c source file are already defined
in the main program .obj file.
I declared the functions in separate header files
Are you sure that you didn't actually *define* the function
in the header files?
and used the pre-processor conditional #ifndef FILE_H
to make sure each header is only included once.
But your compiler isn't complaining about multiple *declarations*.
It is complaining about multiple *definitions*.
You can *declare* a function multiple times
but it should only be *defined* once.
Each .c source file includes the associated header as does the
main .c file which calls the functions. I know I have done this before
without any problems, but am I missing a step? Thanks for any help.
Thanks everyone. I think I found the problem. It was not actually the
functions that the errors were citing, but some arrays which I
declared and initiliazed within the header files such as
int riff1[11] = {7,9,10,12,14,12,7,9,5,7,5};
Now that I moved these arrays to the .c source file from the header
everything is working again. I guess I was re-initializing or
re-defining these arrays each time I included the headers. Thanks
again