Which lmic version/source are you using for ESP32?
Which IDE and which (ESP32) board have you selected in the IDE?
When trying to compile your code in PlatformIO (board: Heltec Wifi LoRa 32, platform: Arduino,
library dependencies: ‘IBM LMIC framework v1.51 for Arduino’ and ‘U8g2’) I get several errors that seem to be caused by the fact that the ‘architecture’ (board) is not being recognized in the lmic library:
.piolibdeps\IBM LMIC framework v1.51 for Arduino_ID842\src\hal\hal.cpp:26:2: error: #error unrecognized architecture
#error unrecognized architecture
After doing some more checking:
‘IBM LMIC framework v1.5 for Arduino’ is the following library:
‘IBM LMIC framework v1.51 for Arduino’ is the following library:
I assume that you probably used v1.5(?)
When using v1.5 I still get some compile errors but the ‘unrecognized architecture’ has disappeared.