I’m trying to make a WiFi enabled egg-cooker. I have a working Arduino sketch and am now trying to port it to ESPHome so that it can interface with Home Assistant. Here’s a link to the code: Smart-Egg-Cooker/eggslice at feature-esphome · Amanoo/Smart-Egg-Cooker · GitHub
In this folder, run these commands:
python3 -m venv venv
source venv/bin/activate
pip3 install esphome
pip3 install tornado esptool
esphome run eggcooker.yaml
This will compile the whole thing. However, it will eventually throw an error:
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:105: multiple definition of `m_asFont'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:105: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:106: multiple definition of `m_asPage'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:106: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:104: multiple definition of `m_drv'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:104: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:103: multiple definition of `m_gui'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:103: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:110: multiple definition of `m_asPage1ElemRef'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:110: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:109: multiple definition of `m_asPage1Elem'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:109: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:112: multiple definition of `m_asPage2ElemRef'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:112: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:111: multiple definition of `m_asPage2Elem'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:111: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:114: multiple definition of `m_asPage3ElemRef'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:114: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:113: multiple definition of `m_asPage3Elem'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:113: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:116: multiple definition of `m_asKeypadAlphaElemRef'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:116: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:115: multiple definition of `m_asKeypadAlphaElem'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:115: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:118: multiple definition of `m_sListbox2'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:118: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:120: multiple definition of `m_acListboxBuf2'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:120: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:121: multiple definition of `m_sListScroll2'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:121: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:117: multiple definition of `m_sKeyPadAlpha'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:117: first defined here
/home/marco/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/eggcooker/src/main.cpp.o: in function `InitGUIslice_gen()':
/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:169: multiple definition of `InitGUIslice_gen()'; .pioenvs/eggcooker/src/eggslice.cpp.o:/home/marco/Desktop/eggcookeresphome/.esphome/build/eggcooker/src/eggslice_GSLC.h:169: first defined here
collect2: error: ld returned 1 exit status
*** [.pioenvs/eggcooker/firmware.elf] Error 1
I’m not sure why there are “multiple definitions”. I just have a file that I import. It didn’t throw this error when the same file was in my Arduino sketch. I checked my include guards, and they’re there. I checked m_asFont for occurences in my files, but it only exists in eggslice_GSLC.h where it’s defined once and used once. Definitely not multiple definitions. As best I can tell, there are no multiple definitions, it shouldn’t even be possible.