TheThingsNetwork / arduino-device-lib

Arduino Library for TTN Devices
MIT License
206 stars 96 forks source link

Problem with including <TheThingsNetwork.h> and <MKRWAN.h> libraries on arduino project #288

Closed Creperi closed 1 year ago

Creperi commented 1 year ago

Hello. I am working on an IoT project and i encounter an issue. I try to include both libraries in two ways(zip and Manage libraries) and it throws the following error.

In file included from C:\Users\elias\OneDrive\Desktop\SendToTTN\SendToTTN.ino:1:0:
c:\Users\elias\OneDrive\Desktop\SendToTTN\libraries\TheThingsNetwork\src/TheThingsNetwork.h:161:8: error: default argument missing for parameter 5 of 'bool TheThingsNetwork::join(const char*, const char*, int8_t, uint32_t, lorawan_class_t)'
   bool join(const char *appEui, const char *appKey, int8_t retries = -1, uint32_t retryDelay = 10000, lorawan_class_t lw_class);
        ^~~~
In file included from C:\Users\elias\OneDrive\Desktop\SendToTTN\SendToTTN.ino:2:0:
c:\Users\elias\OneDrive\Desktop\SendToTTN\libraries\MKRWAN\src/MKRWAN.h:263:15: error: redeclaration of 'CLASS_A'
     CLASS_A = 'A',
               ^~~
In file included from C:\Users\elias\OneDrive\Desktop\SendToTTN\SendToTTN.ino:1:0:
c:\Users\elias\OneDrive\Desktop\SendToTTN\libraries\TheThingsNetwork\src/TheThingsNetwork.h:54:3: note: previous declaration 'lorawan_class_t CLASS_A'
   CLASS_A,
   ^~~~~~~
In file included from C:\Users\elias\OneDrive\Desktop\SendToTTN\SendToTTN.ino:2:0:
c:\Users\elias\OneDrive\Desktop\SendToTTN\libraries\MKRWAN\src/MKRWAN.h:264:5: error: redeclaration of 'CLASS_B'
     CLASS_B,
     ^~~~~~~
In file included from C:\Users\elias\OneDrive\Desktop\SendToTTN\SendToTTN.ino:1:0:
c:\Users\elias\OneDrive\Desktop\SendToTTN\libraries\TheThingsNetwork\src/TheThingsNetwork.h:55:3: note: previous declaration 'lorawan_class_t CLASS_B'
   CLASS_B,
   ^~~~~~~
In file included from C:\Users\elias\OneDrive\Desktop\SendToTTN\SendToTTN.ino:2:0:
c:\Users\elias\OneDrive\Desktop\SendToTTN\libraries\MKRWAN\src/MKRWAN.h:265:5: error: redeclaration of 'CLASS_C'
     CLASS_C,
     ^~~~~~~
In file included from C:\Users\elias\OneDrive\Desktop\SendToTTN\SendToTTN.ino:1:0:
c:\Users\elias\OneDrive\Desktop\SendToTTN\libraries\TheThingsNetwork\src/TheThingsNetwork.h:56:3: note: previous declaration 'lorawan_class_t CLASS_C'
   CLASS_C
   ^~~~~~~

exit status 1

Compilation error: default argument missing for parameter 5 of 'bool TheThingsNetwork::join(const char*, const char*, int8_t, uint32_t, lorawan_class_t)'

which means the enum values has already declared. My source code doesn't have an issue.

jpmeijers commented 1 year ago

My source code doesn't have an issue.

That may be the case, but this error tells me you are declaring CLASS_A, CLASS_B and CLASS_C somewhere else in your code, and that is creating a conflict. Most likely in the MKRWAN.h LoRa library. It does not make sense including two lora libraries, and will create more issues than just this redeclaration.

For now I'd say this is a #wontfix on our side.