I am two C files in a project. 1. main.c 2. rtc.c and third one is header file for both in which all prototypes are defined.
I want to use a bit variables named aon and aoff in both files. Now three condition arises
1. i declare extern bit aon,aoff; in header file but it gives error
//ERROR L104: MULTIPLE PUBLIC DEFINITIONSERROR L104: MULTIPLE PUBLIC DEFINITIONSERROR L104: MULTIPLE PUBLIC DEFINITIONSextern bit aon=0,aoff=0;
2. i declare extern bit aon,aoff; in onlyin main file but it gives error
aon and aoff not declared in rtc; and vice versa
3. i declare in both c files than again i gives error
Why?
Hello!. Maybe this help to you. Define the variables as follows in main.h or main.c
unsigned long var1; unsigned long var2;
in othe header file where you need to define this variable define as follows
extern unsigned long var1; extern unsigned long var2;
Sorry for my english.:) With best regards Artem Gusev.
Sorry, i dont't in details read you message and don't noticed that it is about bit variable. Maybe this link help to you. http://www.keil.com/support/man/docs/c51/c51_le_bitaddrobj.htm
i declare
Actually, no, you didn't, because this
extern bit aon,aoff;
is not what you actully wrote. You defined those variables instead:
extern bit aon=0,aoff=0;
Pick up your C textbook and read up on the difference between a definition and a declaration. If you don't have a textbook, it's high time you got one.
Thanks good link you provided.
No matter which language and how it is. Main concern is to convey message. So don't worry about it. But for excel you have to do command on it.
Very nice.
Thanks i was not aware of this. Problem is solved.