I declared a mailbox 'DMAmbx' in a header file called definitions.h, initialized it in the main function and used it to send messages through an interrupt service routine in a different file (dma.cpp). Both main.cpp and dma.cpp have the header file included. The header file has include guards.
The program compiled each file with no errors. However, I received the error L6200E during linking. The error was that the symbol DMAmbx was multiply defined by dma.o and main.o.
All examples on Keil using mailboxes have all functions that access them in the same file. Is this a rule? If not, how is it possible to access the mailbox from multiple files?
I see. That makes sense. Thank you, Per!