This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi, I'm having some issues compiling my project on a new computer. I have exactly the same setup, with include paths changed to the new locations, but for some reason there is an error during linking. All other threads mention include protection, which I have, and not to define the variable, only declare it, which I also have.
Overall, the relevant code looks like this:
main.c :
#include "UART.h" #include "stopwatch.h" #include "uut_gpio.h"
UART.h :
#ifndef UART_H_ #define UART_H_ xQueueHandle xUARTReadQueue1; #endif /* UART_H_ */
The stopwatch.h and uut_gpio.h files do not include UART.h, and xUARTReadQueue1 is defined in UART.c and used in both UART.c and main.c. Also seeming strange to me is that the error message doesn't actually say where is is defined or redefined, that is the entire message.
This source line from UART.h ...
Jack Linton said:xQueueHandle xUARTReadQueue1;
will define (not just declare) a global object xUARTReadQueue1 in every source file that includes UART.h. You probably mean to write ...
extern xQueueHandle xUARTReadQueue1;
Please see this FAQ (not from TI) for more discussion of this situation.
Thanks and regards,
-George