# Heltec Wifi LoRa v2 compilation error due to missing constant declaration

**URL:** <https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382>\
**Category:** LMIC\
**Created:** [August 21, 2020, 7:58am UTC](https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382 "2020-08-21T07:58:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rushzone](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/rushzone/32/25844_2.png) [@rushzone](https://www.thethingsnetwork.org/forum/u/rushzone)\
**Post date:** [August 21, 2020, 7:58am UTC](https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382/1 "2020-08-21T07:58:35Z")

</div>

Hi @all

I am new to all this LoRa Stuff. At first I want to build a ttnmapper like shown on  
[https://github.com/noppingen/Lora-TTNMapper-Heltec-v2](https://github.com/noppingen/Lora-TTNMapper-Heltec-v2) and [https://github.com/sistemasorp/Heltec-Wifi-Lora-32-TTN-Mapper](https://github.com/sistemasorp/Heltec-Wifi-Lora-32-TTN-Mapper)

**I have allready installed**

- the newest Arduino v 1.8.13 with the ESP32 BSPs from  
[https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package\_esp32\_index.json](https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json)

_Libraries:_  
-MCCI LoRaWAN LMIC library by IBM, Matthias Kooijman, Terry Morre, ChaeHee Won, Frank Rose Version 3.2.0

- u8g2 from oliver Version 2.27.6
- TinyGPS++

## But when I try to compile the scatch, different errors are popping up that some defines are not declared:

In file included from /home/rush/Arduino/libraries/MCCI\_LoRaWAN\_LMIC\_library/src/arduino\_lmic.h:26:0,  
from /home/rush/Arduino/libraries/MCCI\_LoRaWAN\_LMIC\_library/src/lmic.h:28,  
from /home/rush/Arduino/sketch\_aug20a/sketch\_aug20a.ino:27:  
/home/rush/Arduino/sketch\_aug20a/sketch\_aug20a.ino: In function ‘void setup()’:  
sketch\_aug20a:435:48: error: ‘DR\_SF12’ was not declared in this scope  
LMIC\_setupChannel(0, 868100000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
^  
/home/rush/Arduino/libraries/MCCI\_LoRaWAN\_LMIC\_library/src/lmic/lmic.h:653:50: note: in definition of macro ‘DR\_RANGE\_MAP’  
#define DR\_RANGE\_MAP(drlo,drhi) (((u2\_t)0xFFFF\<\<(drlo)) & ((u2\_t)0xFFFF\>\>(15-(drhi))))  
^  
sketch\_aug20a:435:67: error: ‘BAND\_CENTI’ was not declared in this scope  
LMIC\_setupChannel(0, 868100000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
^  
In file included from /home/rush/Arduino/libraries/MCCI\_LoRaWAN\_LMIC\_library/src/arduino\_lmic.h:26:0,  
from /home/rush/Arduino/libraries/MCCI\_LoRaWAN\_LMIC\_library/src/lmic.h:28,  
from /home/rush/Arduino/sketch\_aug20a/sketch\_aug20a.ino:27:  
sketch\_aug20a:436:57: error: ‘DR\_SF7B’ was not declared in this scope  
LMIC\_setupChannel(1, 868300000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7B), BAND\_CENTI); // g-band  
^  
/home/rush/Arduino/libraries/MCCI\_LoRaWAN\_LMIC\_library/src/lmic/lmic.h:653:79: note: in definition of macro ‘DR\_RANGE\_MAP’  
#define DR\_RANGE\_MAP(drlo,drhi) (((u2\_t)0xFFFF\<\<(drlo)) & ((u2\_t)0xFFFF\>\>(15-(drhi))))  
^  
sketch\_aug20a:443:48: error: ‘DR\_FSK’ was not declared in this scope  
LMIC\_setupChannel(8, 868800000, DR\_RANGE\_MAP(DR\_FSK, DR\_FSK), BAND\_MILLI); // g2-band  
^  
/home/rush/Arduino/libraries/MCCI\_LoRaWAN\_LMIC\_library/src/lmic/lmic.h:653:50: note: in definition of macro ‘DR\_RANGE\_MAP’  
#define DR\_RANGE\_MAP(drlo,drhi) (((u2\_t)0xFFFF\<\<(drlo)) & ((u2\_t)0xFFFF\>\>(15-(drhi))))  
^  
sketch\_aug20a:443:67: error: ‘BAND\_MILLI’ was not declared in this scope  
LMIC\_setupChannel(8, 868800000, DR\_RANGE\_MAP(DR\_FSK, DR\_FSK), BAND\_MILLI); // g2-band  
^  
Mehrere Bibliotheken wurden für “WiFi.h” gefunden  
Benutzt: /home/rush/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi  
Nicht benutzt: /home/rush/Downloads/arduino-1.8.13/libraries/WiFi  
exit status 1  
‘DR\_SF12’ was not declared in this scope

* * *

When I comment the lines:  
LMIC\_setupChannel(0, 868100000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
LMIC\_setupChannel(1, 868300000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7B), BAND\_CENTI); // g-band  
LMIC\_setupChannel(2, 868500000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
LMIC\_setupChannel(3, 867100000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
LMIC\_setupChannel(4, 867300000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
LMIC\_setupChannel(5, 867500000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
LMIC\_setupChannel(6, 867700000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
LMIC\_setupChannel(7, 867900000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
LMIC\_setupChannel(8, 868800000, DR\_RANGE\_MAP(DR\_FSK, DR\_FSK), BAND\_MILLI); // g2-band

The scetch will compile and is working, I mean… the GPS, OLED. But I can not see any data coming in on the ttn-console.

The module itself seems to send something because the scatch is programmed to tell the user via Display what is going on. I thing, without the LMIC\_setupChannel command, the modules sends not on the desired 868 Mhz and thus nothing is received. Right?

But whats wrong with the library ??? I spend almost lots of hours but cound not get any step further.

Who can help me?

Btw: I also changed the keys for my application. Just for completeness 😉

Kind regards

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [August 21, 2020, 8:12am UTC](https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382/2 "2020-08-21T08:12:45Z")

</div>

If you’re using the Arduino IDE: did you change the configuration in Arduino/libraries/MCCI\_LoRaWAN\_LMIC\_library/project\_config/lmic\_project\_config.h ?

---

<div class="post-metadata">

**Author:** ![rushzone](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/rushzone/32/25844_2.png) [@rushzone](https://www.thethingsnetwork.org/forum/u/rushzone)\
**Post date:** [August 21, 2020, 8:21am UTC](https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382/3 "2020-08-21T08:21:39Z")

</div>

There is no folder named “project-config” nor the file “lmic\_project\_config.h”

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [August 21, 2020, 8:28am UTC](https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382/4 "2020-08-21T08:28:11Z")

</div>

Yes, there is, not in your own code but [in the library’s folder](https://github.com/mcci-catena/arduino-lmic/blob/master/project_config/lmic_project_config.h). (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](https://github.com/mcci-catena/arduino-lmic#configuration)

---

<div class="post-metadata">

**Author:** ![rushzone](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/rushzone/32/25844_2.png) [@rushzone](https://www.thethingsnetwork.org/forum/u/rushzone)\
**Post date:** [August 21, 2020, 8:32am UTC](https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382/5 "2020-08-21T08:32:19Z")

</div>

Oh sorry, had to step up one more folder 😉

Thank you very much! I havent seen this file before. I read about it, but could not find it since I searched in the src-folde r 🙄

Hope the rest will be working too 🙂

---

<div class="post-metadata">

**Author:** ![tawongat](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/tawongat/32/42152_2.png) [@tawongat](https://www.thethingsnetwork.org/forum/u/tawongat)\
**Post date:** [July 5, 2022, 6:48pm UTC](https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382/6 "2022-07-05T18:48:54Z")

</div>

After adjusting the lmic\_project\_config, Did you manage to get it to connect and send to the ttn network or did you do something more?

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [July 6, 2022, 8:12am UTC](https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382/7 "2022-07-06T08:12:26Z")

</div>



---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [July 6, 2022, 8:16am UTC](https://www.thethingsnetwork.org/forum/t/heltec-wifi-lora-v2-compilation-error-due-to-missing-constant-declaration/39382/8 "2022-07-06T08:16:24Z")

</div>

This is an ancient thread so closing
