Hi Friends, I'm currently working on C51v6.02 by Keil, My Problem goes like this: I have a project which has the files file1.c, file2.c, file3.c. And header files header1.h, header2.h, header3.h. The source code of file1.c goes like this.
#include "header1.h" #include "header2.h" /* My code */
#include "header1.h" #include "header3.h" /* My code */
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS SYMBOL: VARIABLE_NAME MODULE: File_Name.obj (FILE_NAME)
#ifndef __HEADER1_H__ #define __HEADER1_H__ /* My Code */ /* Also includes variables */ #endif
Proudly wasting time since 1981
The message tells you the name of the symbol with the multiple definitions; use that to search all your files & spot the repeats! The duplicates may not necessarily be in the headers I think I've criticised this message before: it's fairly pointless of it to complain about multiple definitions, but then only list one module name! Borland C++ Builder would list all the files which defined the offending symbol, thus making your search much easier!
Borland C++ Builder would list all the files which defined the offending symbol, thus making your search much easier! Oh well, you would do a global search in CodeWright anyhow to find the actual places. Erik
You can use the Linker IXREF directive to figure out which module the symbol already defines. This option is enabled under uVision2 - Project - Options for Target - Listing - Linker - Cross Reference.
I'm sure you can; but my point is that you shouldn't have to! The Linker knows the information, so why doesn't it include it in the message?!! eg *** ERROR L104: MULTIPLE PUBLIC DEFINITIONS SYMBOL: VARIABLE_NAME MODULE: File_Name1.obj (FILE_NAME) MODULE: File_Name2.obj (FILE_NAME) As I've said before, Borland does it like this. What is the point of saying that it's detected multiple definitions, but then only listing one of them!