I am trying to add WebSocket to my ESP32 project, but unfortunately the compiler fails. Following is the error message I get:
…
Indexing .pio\build\esp32_dev\libc94\libArduinoJson.a
Compiling .pio\build\esp32_dev\lib748\FS\FS.cpp.o
Compiling .pio\build\esp32_dev\lib748\FS\vfs_api.cpp.o
In file included from .pio/libdeps/esp32_dev/WebSockets/src/WebSocketsClient.h:28:0,
from include/websocket/websocket_client.hpp:3,
from src/websocket_client.cpp:1:
.pio/libdeps/esp32_dev/WebSockets/src/WebSockets.h:190:30: fatal error: WiFiClientSecure.h: No such file or directory
…
.pio/libdeps/esp32_dev/WebSockets/src/WebSockets.h:189:18: fatal error: WiFi.h: No such file or directory
…
I am using PlatformIO IDE, below is my platformio.ini (the important part):
[env:esp32_dev]
framework = arduino
platform = espressif32
board = esp32dev
platform_packages =
; Uses new tool chain with a non-released Arduino package to be able to compile with C++17 (C++17 may become the default in the future, therefore this may be soon not necessary).
toolchain-xtensa@~5.100200.0
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git
build_unflags =
-std=c++11
-fno-exceptions ; Removes the default exceptions disabling flag.
build_flags =
-std=c++17
-D NO_GLOBAL_SERIAL1
lib_ldf_mode = chain+
lib_deps =
...
; Here I am using the not-released version, because I need a fix for ESP32.
https://github.com/Links2004/arduinoWebSockets.git#ed685e551f9a1a992037f5fdc791a36c4c43abc0
Could anyone please help me to get it compiling? I am not sure what is wrong, because my project compiles as long as I do not add WebSocket library to it.
UPDATE:
Well, I have a new finding, changing lib_ldf_mode from chain+ to chain makes the project compiles. What is going wrong here? I need to use chain+. I believe this used to work in my ESP8266 projects.