I have a project to be programmed on to my LPC 2148.(1 main.c and a couple f header files)
I have made a couple of header files.
I declared a constant in the first header file(say a.h )and included the file in the second header file (say b.h).
now when I compile,wherever i used the constant in b.h,I get the error telling me that the constant is undeclared even though it is declared in the header file which is included in this file.
How can I get around the following error ?I have a lot of constants declared over a set of 22 header files.
Any help is greatly appreciated.
Thanks in advance .
#ifndef __HCI_H__ #define __HCI_H__
You say you've put that in "files" - did you really mean that plural?
These so-called "include guards" should be unique to the file in which they appear.
Maybe you've done your include guards wrong - and that's what's preventing your defines from being effective...?
Just a note here. These leading double underscores you used in your #define shouldn't be there, since it is part of a reserved name space intended for implementing the C standard library.
So even if you have seen lots of header files with a leading __ in the #define, you should consider to instead just use HCI_H or similar as symbol name.