Hi, This is with regards to ADuC7026. I tried to include a header file in my main program. The header file was created by me and consists of a couple of structures, functions and variable definitions. Besides this, I have a main program file and another file with functions - all in the same folder. The header file is included in the main program file. To prevent duplication of the header file in the function file, I inserted 2 lines of code in my function file: #ifndef FIFO_H_ #define FIFO_H_ However, the compiler is not able to recognize the variables and functions in the header file.
First of all - a header file that contains prototypes should be included not only by source files using these functions, but also by the source file that contains the implementation. This will catch incorrect prototypes, i.e. if you change the number of parameters or parameter types.
Second - have you tried to uncomment the lines with #ifndef FIFO_H #define FIFO_H #endif // FIFO_H and seen if the function prototypes will be processed? This would indicate that your project (or any other file included) somewhere defines the FIFO_H symbol.
Have you checked your include file so it doesn't contain any spelling errors?
The header file is included in the main program file.
First mistake. If you have only two source files, the header file must included into both of them. Otherwise it makes no sense to have a header file in the first place.
inserted 2 lines of code in my function file:
Second mistake: you would have to insert 3 lines You missed the #endif to go with the #ifndef.
Third mistake: those lines have no business being put into the "function file". They go to the top and bottom of the header file.
However, the compiler is not able to recognize the variables and functions in the header file.
How do you know that? I.e. what were the actual symptoms?