This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

L6200E Error, Multiple Declarations

I keep getting a linker error suggesting that a few variables (and some functions) have been declared across multiple files. I've triple checked the files (they're not large) and the erring functions/variables have NOT been declared more than once.

Interestingly, it seems to occur between the file that contains the main function and file A for some, and main and B for some others. Which means that the main file is common. But, the main file does not have these declarations.

Can multiple *definitions* of the same C files, or including the same C files across different #include appearances (in different files) cause the problem?

Any help will be appreciated.

Parents
  • "files A.c and B.c were included in the main file AND added separately as part of the project. I did not know that this was not allowed."

    It is allowed; but if you do it, then you have to ensure that it is done right - in particular, that it doesn't cause multiple definitions.

    However, just because it can be done doesn't mean that it's a good idea!

    In general, you do not #include .c files - you compile them separately, and let the Linker join the pieces together...

Reply
  • "files A.c and B.c were included in the main file AND added separately as part of the project. I did not know that this was not allowed."

    It is allowed; but if you do it, then you have to ensure that it is done right - in particular, that it doesn't cause multiple definitions.

    However, just because it can be done doesn't mean that it's a good idea!

    In general, you do not #include .c files - you compile them separately, and let the Linker join the pieces together...

Children
No data