Heltec Wifi LoRa v2 compilation error due to missing constant declaration

Yes, there is, not in your own code but in the library’s folder. (Which is horrible, but like documented: The Arduino environment doesn’t give us a better way to do this, unless you change BOARDS.txt.)

See also https://github.com/mcci-catena/arduino-lmic#configuration