No such a file or directory

Good day to all , I am using IDE verion 2.3.6 on my win_11 PC.

I do have a sketch that starts like this:

#include <esp_now.h> // for esp32

#include <WiFi.h> // for esp32

#include <ArduinoOTA.h>

#include <User_Setup.h>

#include <TFT_eSPI.h> // Graphics and font library for ILI9341 driver chip

TFT_eSPI tft = TFT_eSPI(); // Invoke library

#include <Wire.h>

#include <AHT20.h>

AHT20 aht20;

<CODE\>

>>> and it compiles with NO errors and also works very well.

If I do insert a comment or a blank line before the first include (#include <esp_now.h> // for esp32) I get a copile error like this: Compilation error: WiFi.h: No such file or directory

I do not find out thereason up to now.

Any help please ?

Thanks in advance

Odd compile error: "No such file or directory" cause: #include #define SOLVED - #18 by ptillisch ?

it works well now !

thanks a lot for the great help.

regards.