i have defined
#define key0 0x35
Create your own header file, for example "keys.h" and include it in any file which use defines of the header file. /* header file */ #if !defined(KEYS_H_HDR) #define KEYS_H_HDR #define key0 0x35 ... #endif /* in source file use (for example) ... */ #include "keys.h" Vaclav
"Does keil have any provision..." this is absolutely standard 'C' stuff - nothing special about Keil! I suggest that you need to get a good, standard 'C' text book.
Thanks Vaclav & Andrew I am new to programming in C,book to which i had reffered did not carry detail about this. Is it neccessary that header file created by us should be kept in "inc" folder. doubt!! --> KEYS_H_HDR (#ifndef KEYS_H_HDR #define KEYS_H_HDR ) Does this should be same as header file name ?
"book to which i had reffered did not carry detail about this." In that case, it does not qualify as a "good" book on 'C' - this is fundamental stuff. "Is it neccessary that header file created by us should be kept in "inc" folder." No. As with any application trying to find a file, there are certain default locations where the compiler will look, and a certain order in which it will try the alternatives - or you can explicitly state the file's location by includinging a full or relative path. You need to read the Compiler Manual for details. For C51, see the INCDIR directive.
Arjun asked: > doubt!! --> KEYS_H_HDR > (#ifndef KEYS_H_HDR > #define KEYS_H_HDR ) > Does this should be same as header file > name ? The label name is arbitrary, but it keeps things neat to make it the same as the header filename. This is a very common technique to avoid "multiple definition" errors if the same header file is referred to twice. (The first reference will "define" KEYS_H_HDR, so a second reference will "comment out" the entire contents of the header file. If your C textbook does not refer to header files, then get another one. This is a fundamental part of the C language.