manuelbl / ttn-esp32

The Things Network device library for ESP32 (ESP-IDF) and SX127x based devices
MIT License
301 stars 64 forks source link

Linker error due to missing extern "C" in void app_main() {} in file main.cpp when using platformio #51

Closed mike6000 closed 2 years ago

mike6000 commented 2 years ago

When using platformio: got a linker error related to main.cpp I changed main.cpp to have extern "C" directives extern "C" void app_main() {} The linker error disappeared after this change. I suggest main.cpp is updated or the wiki info on how to use platformio is updated.

manuelbl commented 2 years ago

Which web page and/or code example are you referring to? As far as I can see, all C++ samples use the extern "C" declaration.

mike6000 commented 2 years ago

I just followed the instructions here: https://github.com/manuelbl/ttn-esp32/wiki/Using-PlatformIO and compiled as instructed. I realize now that the app_main() probably may have been generated by platformio and therefore is missing the extern "C" syntax. I didnt come so far as to test the examples yet. Just checked that the main skeleton code compiled. Perhaps the doc in the wiki should be updated with that the users should try one of the examples?

mike6000 commented 2 years ago

Closing. Hopefully this info will help others.