I have a folder with my custom (and downloaded libraries) that I include them in my projects. I use lib_extra_dirs = ..\..\common
Usually, my projects compile successfully. My newest project uses ESP8266 or ESP32 based on #ifdef ESP32
. For example:
#ifdef ESP8266
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncDNSServer.h> // <-- why this library is included when I compile for ESP32?
#elif defined(ESP32)
#include <WiFi.h>
#include <AsyncTCP.h>
#include <DNSServer.h>
#else
#error not supported platform
#endif
The above commented library is in ../../common/ESPAsyncDNSServer
folder. If I compile for ESP32 it is included in compilation and of course gives errors:
Dependency graph for ESP32:
|-- <WebConfig2>
| |-- <AsyncTCP> 1.1.1
| |-- <ESPAsyncDNSServer> <---- This should not be included
| | |-- <ESPAsyncUDP>
| |-- <WiFi> 1.0
| |-- <DNSServer> 1.1.0
| | |-- <WiFi> 1.0
| |-- <ESPAsyncWebServer>
| | |-- <AsyncTCP> 1.1.1
| | |-- <ArduinoJson> 6.15.0
| | |-- <WiFi> 1.0
| | |-- <FS> 1.0
| |-- <GlobalSettings>
| | |-- <SPIFFS> 1.0
| | | |-- <FS> 1.0
| | |-- <ArduinoJson> 6.15.0
| | |-- <WiFi> 1.0
| | |-- <FS> 1.0
| |-- <ArduinoJson> 6.15.0
| |-- <Helper>
| | |-- <SPIFFS> 1.0
| | | |-- <FS> 1.0
| | |-- <ArduinoJson> 6.15.0
| | |-- <FS> 1.0
| | |-- <WiFi> 1.0
|-- <GlobalSettings>
| |-- <SPIFFS> 1.0
| | |-- <FS> 1.0
| |-- <ArduinoJson> 6.15.0
| |-- <WiFi> 1.0
| |-- <FS> 1.0
If I compile only for ESP and I comment out the line #include <ESPAsyncDNSServer.h>
it compiles successfully.
platformio.ini:
[platformio]
build_dir=C:\programming\pio\build
[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
monitor_speed = 115200
lib_extra_dirs =
..\..\common
[env:esp32_cam]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_extra_dirs =
..\..\common
Any help is appreciated.