Skip to content

Unable to Compile WebSockets example With Visual Code/Platform IO for an ESP8266 #179

@aramperez

Description

@aramperez

Platform

ESP8266

IDE / Tooling

PlatformIO

What happened?

I'm on a PC running Windows 11 Home, using Visual Code <Version: 1.100.0 (user setup), Commit: 19e0f9e681ecb8e5c09d8784acaa601316ca4571, Date: 2025-05-07T12:48:53.763Z, Electron: 34.5.1, ElectronBuildId: 11369351, Chromium: 132.0.6834.210, Node.js: 20.19.0, V8: 13.2.152.41-electron.0, OS: Windows_NT x64 10.0.26100> and PlatformIO <Core 6.1.18·Home 3.4.4>. I created a new project for NodeMCU and call it WebSockets. I open the main.cpp and replace the initial code with the code from the WebSockets example. I use the PlatformIO Library Manager to install ESPAsyncWebServer and get the following:

Resolving nodemcuv2 dependencies...
Installing esp32async/ESPAsyncWebServer @ ^3.7.7
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
ESPAsyncWebServer@3.7.7 has been installed!
Resolving dependencies...
Installing ESP32Async/AsyncTCP @ ^3.4.0
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
AsyncTCP@3.4.1 has been installed!
Installing ESP32Async/ESPAsyncTCP @ ^2.0.0
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
ESPAsyncTCP@2.0.0 has been installed!
Installing ayushsharma82/RPAsyncTCP @ ^1.3.2
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
RPAsyncTCP@1.3.2 has been installed!

After clicking the Build button, I get the following:

  • Executing task: C:\Users\aramp.platformio\penv\Scripts\platformio.exe run

Processing nodemcuv2 (platform: espressif8266; board: nodemcuv2; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 (4.1.0) > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:

  • framework-arduinoespressif8266 @ 3.30101.0 (3.1.1)
  • tool-esptool @ 1.413.0 (4.13)
  • tool-esptoolpy @ 1.30000.201119 (3.0.0)
  • toolchain-xtensa @ 2.100300.220621 (10.3.0)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 41 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- ESPAsyncWebServer @ 3.7.7
    |-- AsyncTCP @ 3.4.1
    |-- ESP8266WiFi @ 1.0
    |-- ESPAsyncTCP @ 2.0.0
    |-- RPAsyncTCP @ 1.3.2
    Building in release mode
    Compiling .pio\build\nodemcuv2\src\main.cpp.o
    Generating LD script .pio\build\nodemcuv2\ld\local.eagle.app.v6.common.ld
    Compiling .pio\build\nodemcuv2\lib7f3\Hash\Hash.cpp.o
    Compiling .pio\build\nodemcuv2\libced\RPAsyncTCP\AsyncPrinter.cpp.o
    Compiling .pio\build\nodemcuv2\libced\RPAsyncTCP\RPAsyncTCP.cpp.o
    Compiling .pio\build\nodemcuv2\libced\RPAsyncTCP\RPAsyncTCP_buffer.cpp.o
    Compiling .pio\build\nodemcuv2\libced\RPAsyncTCP\SyncClient.cpp.o
    Compiling .pio\build\nodemcuv2\libced\RPAsyncTCP\cbuf.cpp.o
    Compiling .pio\build\nodemcuv2\libced\RPAsyncTCP\debug.cpp.o
    Compiling .pio\build\nodemcuv2\libced\RPAsyncTCP\tcp_axtls.c.o
    Compiling .pio\build\nodemcuv2\lib0a6\AsyncTCP\AsyncTCP.cpp.o
    Compiling .pio\build\nodemcuv2\libc6f\ESP8266WiFi\BearSSLHelpers.cpp.o
    Compiling .pio\build\nodemcuv2\libc6f\ESP8266WiFi\CertStoreBearSSL.cpp.o
    In file included from .pio\libdeps\nodemcuv2\AsyncTCP\src\AsyncTCP.cpp:4:
    .pio\libdeps\nodemcuv2\AsyncTCP\src\AsyncTCP.h:10:10: fatal error: esp_idf_version.h: No such file or directory


10 | #include <esp_idf_version.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\nodemcuv2\lib0a6\AsyncTCP\AsyncTCP.cpp.o] Error 1
In file included from .pio\libdeps\nodemcuv2\RPAsyncTCP\src\AsyncPrinter.h:26,
from .pio\libdeps\nodemcuv2\RPAsyncTCP\src\AsyncPrinter.cpp:26:
.pio\libdeps\nodemcuv2\RPAsyncTCP\src\RPAsyncTCP.h:5:10: fatal error: WiFi.h: No such file or directory



5 | #include <WiFi.h>
  |          ^~~~~~~~

compilation terminated.
In file included from .pio\libdeps\nodemcuv2\RPAsyncTCP\src\RPAsyncTCP.cpp:7:
.pio\libdeps\nodemcuv2\RPAsyncTCP\src\RPAsyncTCP.h:5:10: fatal error: WiFi.h: No such file or directory



5 | #include <WiFi.h>
  |          ^~~~~~~~

compilation terminated.
*** [.pio\build\nodemcuv2\libced\RPAsyncTCP\AsyncPrinter.cpp.o] Error 1
*** [.pio\build\nodemcuv2\libced\RPAsyncTCP\RPAsyncTCP.cpp.o] Error 1
In file included from .pio\libdeps\nodemcuv2\RPAsyncTCP\src\RPAsyncTCP_buffer.h:11,
from .pio\libdeps\nodemcuv2\RPAsyncTCP\src\RPAsyncTCP_buffer.cpp:8:
.pio\libdeps\nodemcuv2\RPAsyncTCP\src\RPAsyncTCP.h:5:10: fatal error: WiFi.h: No such file or directory



5 | #include <WiFi.h>
  |          ^~~~~~~~

compilation terminated.
In file included from .pio\libdeps\nodemcuv2\RPAsyncTCP\src\SyncClient.cpp:7:
.pio\libdeps\nodemcuv2\RPAsyncTCP\src\RPAsyncTCP.h:5:10: fatal error: WiFi.h: No such file or directory



5 | #include <WiFi.h>
  |          ^~~~~~~~

compilation terminated.
*** [.pio\build\nodemcuv2\libced\RPAsyncTCP\RPAsyncTCP_buffer.cpp.o] Error 1
*** [.pio\build\nodemcuv2\libced\RPAsyncTCP\SyncClient.cpp.o] Error 1
==================================================== [FAILED] Took 3.94 seconds ====================================================

  • The terminal process "C:\Users\aramp.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

I created another issue/discussion related to not being able to compile the examples with the Arduino IDE.

Stack Trace

Not applicable.

Minimal Reproductible Example (MRE)

The project is attached.

WebSockets.zip

I confirm that:

  • I have read the documentation.
  • I have searched for similar discussions.
  • I have searched for similar issues.
  • I have looked at the examples.
  • I have upgraded to the lasted version of ESPAsyncWebServer (and AsyncTCP for ESP32).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions