I am developing a program to read NFC cards, and I have a header file, source.h, holding all the variables for use in it's related source code, source.c. A sample is as shown below:
#ifdef __cplusplus
extern "C" {
#endif
int SDA_SUPPORT_PRESENT = 0;
int DDA_SUPPORT_PRESENT = 0;
int CDA_SUPPORT_PRESENT = 0;
int CARDHOLDER_VERIFICATION_PRESENT = 0;
...
The source code, source.c, holds the methods utilizing the above defined variables. A sample is as shown:
#include <source.h>
extern void translateError(uint8 error, int slot) //one of the methods
{
TP_DbgSerialPrn("\n\rDevice Error: ");
switch(error)
{
...
I also have a source file, CardReader.c, which calls the methods included in source.c, and which has a related header file, CardReader.h. The issue is, when I include the source.h file in the CardReader.h file, i get the following error:
../CardReader.o:(.bss+0x12b4): first defined here
../source.o:(.bss+0x12b8): multiple definition of `SLOT_NUMBER'
../CardReader.o:(.bss+0x12b8): first defined here
../source.o:(.data+0x49): multiple definition of `LISTED_APPLICATION_IDS'
../CardReader.o:(.data+0x49): first defined here
../source.o:(.data+0xc9): multiple definition of `LISTED_APPLICATION_IDS_LENGTH'
All the rest of the error messages are of the same type. The source.h file is included as indicated in CardReader.h:
#include <TPCardReader.h>
#include <source.h>
#ifdef __cplusplus
extern "C" {
#endif
...
with the path variables set properly, so it can be found, and then called the CardReader.h file as usual in CardReader.c. My question is why is that error coming up, yet I have only defined each of the specified variables once in source.h? Is there something am missing or not doing or do I not understand the error?