Page 1 of 1

cannot compile for ESP32

Posted: Sat Jan 23, 2021 11:08 pm
by plusmartin
Hi!

I want to receive serial messages from my ESP32 without having to connect a USB cable.

Im following this tutorial:

https://www.megunolink.com/articles/wir ... with-mdns/

The section called: "mDNS for ESP32 and ESP8266" says that I should add #include "ESPmDNS.h" and some code to be executed upon connecting to a wifi.

I am using PlatformIO on VS Code running Arduino for ESP32, but the library for "ESPmDNS.h" is not available there. I downloaded it directly from: https://raw.githubusercontent.com/espre ... /ESPmDNS.h
Is this the right one?

then I copied the AdvertiseServices code and added a AdvertiseServices("myname"); right after connecting to the wifi, however when compiling it I get this error:



...
.pio/build/esp32dev/src/main.cpp.o:(.literal._Z17AdvertiseServicesPKc+0x0): undefined reference to `MDNS'
.pio/build/esp32dev/src/main.cpp.o:(.literal._Z17AdvertiseServicesPKc+0x18): undefined reference to `MDNSResponder::begin(char const*)'
.pio/build/esp32dev/src/main.cpp.o:(.literal._Z17AdvertiseServicesPKc+0x1c): undefined reference to `MDNSResponder::addService(char*, char*, unsigned short)'
.pio/build/esp32dev/src/main.cpp.o: In function `AdvertiseServices(char const*)':
/Users/martingarcia/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:85: undefined reference to `MDNSResponder::begin(char const*)'
/Users/martingarcia/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:85: undefined reference to `MDNSResponder::addService(char*, char*, unsigned short)'
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1
======================================================== [FAILED] Took 11.18 seconds ========================================================
The terminal process "pio 'run'" terminated with exit code: 1.



any ideas? thanks!

Re: cannot compile for ESP32

Posted: Sun Jan 24, 2021 12:17 am
by philr
Hi, can you try getting it going using the standard arduino IDE and one of our library examples first? Its hard to know where the problem lies. Seems like its missing library files but I'm not familiar with Platform IO.

Cheers
Phil