We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
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?