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.
"int a" tells the compiler to reserve space for an integer. Close, yet not quite completely correct. The statements
int a = 0; int b = some_value;
int a;
extern int a;
int a; int a; int a = 5;
int a = 5; int a = 5;