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

MULTIPLE PUBLIC DEFINITIONS ?

i write a global.h file:

#ifndef GLOBAL_H
#define GLOBAL_H

int nGlobal;
#endif

//file A.c
#include "global.h"
....

//file B.c
#include "global.h"
....

Build target 'Target 1'
compiling A.c...
compiling B.c...
linking...
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: nGLOBAL
MODULE: A.obj
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: nGLOBAL
MODULE: B.obj

oh,why the error do not happen when i write code "#include <reg51.h>" in several .c files.
please help me,thank you very much.

0