Heltec WiFi_LoRa_32_V3 Compile Error - undefined reference to `Radio'

hi, your repo example code works well, super thanks ! I am trying to make Heltec OTAA example code working on top of it but found some errors, fixing them now.

Better just use the premade example?

I tried your repo and this ino (renamed it to main.cpp under src) but failed to compile.

Below are the errors, any thoughts?

Linking .pio/build/heltec_wifi_lora_32_V3/firmware.elf
/Users/junwen/.platformio/packages/toolchain-xtensa-esp32s3/bin/…/lib/gcc/xtensa-esp32s3-elf/8.4.0/…/…/…/…/xtensa-esp32s3-elf/bin/ld: .pio/build/heltec_wifi_lora_32_V3/src/LoRaWan_APP.cpp.o:(.literal._ZL24OnTxNextPacketTimerEventv+0x8): undefined reference to devEui' /Users/junwen/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: .pio/build/heltec_wifi_lora_32_V3/src/LoRaWan_APP.cpp.o:(.literal._ZL24OnTxNextPacketTimerEventv+0xc): undefined reference to appEui’
/Users/junwen/.platformio/packages/toolchain-xtensa-esp32s3/bin/…/lib/gcc/xtensa-esp32s3-elf/8.4.0/…/…/…/…/xtensa-esp32s3-elf/bin/ld: .pio/build/heltec_wifi_lora_32_V3/src/LoRaWan_APP.cpp.o:(.literal._ZL24OnTxNextPacketTimerEventv+0x10): undefined reference to `appKey’

I literally copy-paste the example code I linked above as src/main.cpp and get a successfull compile

Checking size .pio/build/heltec_wifi_lora_32_V3/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   6.9% (used 22508 bytes from 327680 bytes)
Flash: [=         ]  10.4% (used 348985 bytes from 3342336 bytes)
Building .pio/build/heltec_wifi_lora_32_V3/firmware.bin

Are you sure you did it the same? Where are your appEui and appKey arrays defined?

Hi, I found the problem around appEUI and appKey, I replaced with my device info in main.cpp with “AppEUI”, “DevEUI” and “AppKey”, that high case of initial letter leads the compile error. After changing to low case to the initial letter, the compile worked well.

There are two questions as below -
(1) in the compile process, it shows the warning message, “/Users/junwen/.platformio/packages/framework-arduinoespressif32/variants/heltec_wifi_lora_32_V3/pins_arduino.h:7: warning: “WIFI_LoRa_32_V3” redefined
#define WIFI_LoRa_32_V3 true”
(2) in the .ini, shall I use “-D BOARD=WIFI_LoRa_32_V3” or “”-D WIFI_LoRa_32_V3" ?

Thanks again !

Max - Thanks for the repo - I had the same issue… Sanity Restored!

Hi Max,

I ran into the same 2 problems.
I commented out the #define WIFI_LoRa_32_V3 true line in pins_arduino.h, because intellisense didn’t detect its existence either. I also entered the line -D WIFI_LoRa_32_V3 in the platformio.ini file. I also found the libheltec.a file, but I didn’t know how to embed it in the platformio.ini file.
In any case, your solution came at the right time, because I had almost given up on developing with the heltec 0.0.7 library.

Thanks again for your solution

László

I failed to compile the same file wifi_lora_32_v3_factoryTest.ino with arduino IDE 2.2.1. I didnt find solution how to link libheltec.a in this IDE. Previously it worked with Arduino 1.8.2.

Just wanted to update things as of jan '24 with Heltec Library version 1.0.0. The previous solution from @maxgerhardt almost worked for me … but I had to make some minor tweaks based on what I saw going on in the boards.txt file and by running the arduino compile in verbose mode. Here is my build_flags in my platformio.ini. Everything now compiles and runs ok on the V3 board with the 1.0.0 version of the lib. For simplicity I copied the libraries/* into my lib folder and copied libheltec_0.a into the precompiled_libs folder.

build_flags =
   ; radio.c still needs this, but note the change to all uppercase from the earlier example
  -D HELTEC_WIFI_LORA_32_V3
  -D WIFI_LORA_32_V3
  -D LoRaWAN_DEBUG_LEVEL=2
  -D ACTIVE_REGION=LORAMAC_REGION_US915
  -D LORAWAN_PREAMBLE_LENGTH=8
  -D LORAWAN_DEVEUI_AUTO=1
  -Lprecompiled_libs
  -lheltec_0

I’d never have been able to get this far without the example from @maxgerhardt so thanks a ton!

Hope this helps!