toMakeFood doesn't exist because everywhere you have a declaration of it, you're saying "defined elsewhere" due to the extern keyword. Add an includes.c file with this:
bool toMakeFood = false;
And don't forget to link that file in with the rest. The header will provide multiple delcarations while the .c file will provide a single definition. On a side note, I strongly suspect you're compiling as C because bool and true/false require the inclusion of the stdbool.h header.
deceptikon
Challenge Accepted
3,425 posts since Jan 2012
Reputation Points: 822
Solved Threads: 473
Skill Endorsements: 56
Question Answered as of 4 Months Ago by
deceptikon I am using C. I've included stdbool.h, its in the "includes.h" file.
Booya. It's nice to see someone taking advantage of more recent revisions of the C standard.
but I dont understand why main.c is accepting the existance of toMakeFood and timer0.c is not.
That's simply where the lack of a definition is reported. If you remove timer0.c entirely from the project then you'll still get the error because toMakeFood really doesn't exist. You've only provided a name and a type in includes.h, not an actual object that can be worked with.
And the reason why you shouldn't have a definition in includes.h is because then there would be multiple definitions of an object with the same name, which would still result in a linker error. ;)
deceptikon
Challenge Accepted
3,425 posts since Jan 2012
Reputation Points: 822
Solved Threads: 473
Skill Endorsements: 56