ESP32 WiFi.h not found

When I try to build I get the following error:
.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src/ETH.h:27:10: fatal error: WiFi.h: No such file or directory

Why is it not finding WiFi.h? it’s a part of the ESP32 platform.

What are you trying to build and what is the content of your platformio.ini?

I’m building my own code, a tester for lighting networks that can send or receive a universe of lighting data using various protocols.

platformio.ini:

[env]
framework = arduino
lib_ldf_mode = chain+
lib_deps = 
	olikraus/U8g2@^2.34.18
	mathertel/RotaryEncoder@^1.5.3
	neu-rah/ArduinoMenu library@^4.21.4
	forkineye/ESPAsyncE131@^1.0.4
	rstephan/ArtnetWifi@^1.5.1
	hideakitai/ArtNet@^0.3.0
	neu-rah/streamFlow@0.0.0-alpha+sha.bf16ce8926

debug_build_flags = 
	-O0 -ggdb3 -g3
	-D DEBUG

[env:ESP32]
platform = espressif32
board = esp32dev

Does this also happen with a blank new minimalistic WiFi sketch?

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
#include <Arduino.h>
#include <WiFi.h>

void setup() {
    WiFi.begin("", "");
}

void loop() {}

Did some poking, looks like having lib_ldf_mode = chain+ is breaking it.
Here’s a minimal sketch that shows the problem:

platformio.ini

[env:ESP32]
platform = espressif32
board = esp32dev
framework = arduino
lib_ldf_mode = chain+

main.cpp

#include <Arduino.h>
#include <ETH.h>

void setup() {
	ETH.begin();
}

void loop() {
	
}

Sorry, I am not familiar with the Library Dependency Finder modes.
Did you choose this mode for a specific reason?

In the past I’ve had the dependency finder give me issues without chain+ mode (throwing errors because of header files that I didn’t even include), so now I use it by default, as the only difference from the default mode is that chain+ also evaluates preprocessor conditionals when deciding what files to build.
It shouldn’t affect whether or not a file can be found by my understanding.

I have never experienced such problems, so I have never needed chain+.

Yes, that is clear from the documentation.

Ethernet.h is dependent on WiFi.h

What I don’t understand is why the WiFi.h is not found. It is a built-in library.

Maybe @maxgerhardt can shed some light on this.