IDE 1.8.7 Library Location

According to what I have read, if I have a version of a library in the libraries folder inside my sketchbook folder (Sketchbook location in Preferences is F:\Arduino) then this is the one that the IDE should use, however I am getting this message after compiling my sketch:

Multiple libraries were found for "SoftwareSerial.h"
Used: F:\Arduino IDE 160\Arduino\hardware\arduino\avr\libraries\SoftwareSerial
Not used: F:\Arduino\libraries\SoftwareSerial

Should it not have used the second version (which I have modified) rather than the one in the IDE installation?

Regards

Phil.

There are multiple factors that determine which library is chosen by the Arduino IDE when multiple contain a file matching the #include directive. All else the same, the one in the sketchbook does get priority. However, another factor is the quality of the match between the architecture of the selected board and the architectures field in the library's library.properties file: Explicit match > wildcard match > mismatch. If the architectures field is not defined or if the library.properties file is missing, that's treated as a wildcard match. The library at F:\Arduino IDE 160\Arduino\hardware\arduino\avr\libraries\SoftwareSerial has an explicit match to any AVR-based board. So F:\Arduino\libraries\SoftwareSerial will only get priority if it also has an explicit architecture match.

Thanks Pert.

Is there any easy way I can force it to use my modified library?

Phil.

Make sure that F:\Arduino\libraries\SoftwareSerial\library.properties contains the line:

architectures=avr

If it doesn't contain a library.properties file, then create one. You can just copy it from another library if you like. F:\Arduino IDE 160\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\library.properties would be a logical choice.

You can get more information on library.properties here:

Thanks again.I'll check it out in the morning - bedtime here :o

Phil.

Success!

Thanks again Pert for your very quick and informative solution to my question.

Phil.

I'm glad to hear it's working now! The library priority thing is quite confusing, especially since it has not been well documented by Arduino. In response to this thread and another question about the library.properties architectures field in the same day, I have added some information on the topic to the Arduino Library Specification.

Per