I write multi-board projects. I would probably fall asleep if there were no conditionals in my code…
In one of my problem projects, I have PubSubClient and WiFiEsp and I am compiling for Wemos D1R2 and a Due with an ESP01S. The due compiles fine and the Wemos errors like crazy, trying to comple WiFiEsp.
In my src I have
#ifdef ESP_SERIAL
#include <WiFiEsp.h>
#include <WiFiEspClient.h>
#define WiFiClient WiFiEspClient
#else
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiClientSecure.h>
#include <WiFiUdp.h>
#endif
My thoughts would be in the order of “Why is it compiling that library?”. I normally don’t include the “Arduino” lib dir, but I tried and it did the same thing. This seems to be the root of all my past library issues.
Shouldn’t the default behaviour be to only compile the needed library instead of all of them? It is an issue when they are technically incompatible as these examples are.