PlatformIO Community

Old used library generates errors during compilation


#1

HI
I moved code from ESP8266 to ESP32.
I removed Softserial and replaced it with Hardserial.
I did not remove the Softserial library from my local lib folder.
This generates errors.
I moved the lib from local lib to /backup directory newerly created.
The compilation works without errors.

I do not understand why a Library that is not referenced in my code generates errors.
Does it mean that all libraries in the local lib will be integrated in my binary ?
Looks more than a compiler bug !


#2

Hi,
the sources located in the lib directory will be compiled as static libraries and later linked to your binary. The static compilation of the libraries is independent to any references in the main appilcation and the library should not be integrated in the binary if there is no reference.

Please correct me if I’m wrong :slight_smile:


#3

Not sure… if the library is merely present in \lib… it looks like it should be ignored… Perhaps there was still an #include reference to it somewhere? Otherwise, perhaps a Clean (PIO alien head -> Project Tasks -> Clean, or platformio run --target clean from the terminal) is needed to remove the binary leftovers from earlier compiles.