I'm writing an embedded C application in Atmel Studio 6 for an AVR device. I'm not that good at "file hierarchy", but I've been doing my best. Also, thank you for taking the time to open this question.
Here is a file structure of the offending files:
So PLAYOP_FSM.C is a finite state machine that calls lower level functions. Some of the functions that it needs to call are implemented in BTN_INTERFACE.C; defined in BTN_INTERFACE.H
So both: PLAYOP_FSM.C and BTN_INTERFACE.C need to include the header file. Naturally, I put header guards to avoid multiple definitions.
However, I still get:
multiple definition of 'X'
where 'X' is actually my variables: u_yPos and u_xPos.
One of the other errors is:
first defined here
And then it puts a BTN_INTERFACE.O under file.
Here is a snapshot of the error list:
What have I done so far
I checked to make sure I made no "includes" in header files, I didn't accidentally include a ".c" file. I checked to make sure I didn't include BTN_INTERFACE.H anywhere else.
I can get it to compile if I take away the
#include BTN_INTERFACE.H
lines in my PLAYOP_FSM.C file. WHAT'S MORE, if I do that, the compiler does not complain about the function calls I make in PLAYOP_FSM.C, so no errors are thrown when I comment those out.
If I comment out the BTN_INTERFACE.C include lines, then as expected, I get errors concerning "not knowing what the dumb variables are".