undefined reference to `loop' to Build
I installed Platform IO
- Open VSCode Extension Manager
- Search for official PlatformIO IDE extension
- Install PlatformIO IDE.
I downloaded code from Github - https://github.com/matth-x/ArduinoOcpp/tree/master
I don't touch anything in the platformio.ini file
and click build: ==================================================== [SUCCESS] Took 4.28 seconds ====================================================
Environment Status Duration
esp32-development-board SUCCESS 00:00:04.284 ==================================================== 1 succeeded in 00:00:04.284 ====================================================
And I proceed to upload it to NodeMcu v3: - https://content.instructables.com/FUH/CR7X/IVO7W21V/FUHCR7XIVO7W21V.jpg?auto=webp&frame=1&width=522&fit=bounds&md=8f6d8dff76819427b5e42e0a3f250ce7
Result:
A fatal error occurred: This chip is ESP8266 not ESP32. Wrong --chip argument? *** [upload] Error 2 ==================================================== [FAILED] Took 4.21 seconds ============================================== ======
Environment Status Duration
esp32-development-board FAILED 00:00:04.214 ============================================== 1 failed, 0 succeeded in 00:00:04.214 ============================================== =
If I change the configuration in the platformio.ini:
[platform] default_envs = nodemcuv2 and Switch PlatformIO Project Environment for: env:nodemcuv2
I have this result in the build:
Indexing .pio/build/nodemcuv2/libFrameworkArduino.a
Linking .pio/build/nodemcuv2/firmware.elf
/home/zero/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf /bin/ld: .pio/build/nodemcuv2/libFrameworkArduino.a(core_esp8266_main.cpp.o):(.text._ZL12loop_wrapperv+0x4): undefined reference to setup' /home/zero/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf /bin/ld: .pio/build/nodemcuv2/libFrameworkArduino.a(core_esp8266_main.cpp.o):(.text._ZL12loop_wrapperv+0x8): undefined reference to loop'
/home/zero/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf /bin/ld: .pio/build/nodemcuv2/libFrameworkArduino.a(core_esp8266_main.cpp.o): in function loop_wrapper()': core_esp8266_main.cpp:(.text._ZL12loop_wrapperv+0x21): undefined reference to setup'
/home/zero/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf /bin/ld: core_esp8266_main.cpp:(.text._ZL12loop_wrapperv+0x2d): undefined reference to `loop'
collect2: error: ld returned 1 exit status
*** [.pio/build/nodemcuv2/firmware.elf] Error 1
==================================================== [FAILED] Took 24.49 seconds ============================================== ======
Environment Status Duration
nodemcuv2 FAILED 00:00:24.494 ============================================== 1 failed, 0 succeeded in 00:00:24.494 ============================================== =