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

Error L104 Multiple public definitions

I have splitted a C file in to parts and compiled it and it is compiling and I am receiving error message while linking and NO error if compiled as a single file.

Help required.

Thanks in advance :)

  • I have splitted a C file in to parts and compiled it and it is compiling and I am receiving error message while linking and NO error if compiled as a single file.

    Well, of course you're not getting a "multiple public definitions" error while compiling, because the compiler only looks at single files and therefore only sees one public definition. But the linker will look at several input file, and if the same symbol is defined in multiple files, it doesn't know what to do.

    So, look at your source file and eliminate the multiple public definitions of the same symbol (variable, function, whatever).

  • This is basic ANSI 'C' stuff - nothing to do with the 8051 or Keil in particular:

    You need to understand the difference between a definition and a declaration:

    Every symbol must be defined exactly once;

    A symbol may have many declarations;

    See c-faq.com/.../decldef.html