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.
"2, C51 is not a C++ compiler, it's true. In the [C++] book, there are namespaces and classes which can be put in headers. But I delete them." That's all good and fine for an experienced programmer who clearly understands these things - but recommending a C++ book to a novice who is obviously having some problems with basic ANSI 'C' concepts is, I suggest, somewhat unhelpful?