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?



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 file: Explicit match > wildcard match > mismatch. If the architectures field is not defined or if the 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?


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


If it doesn't contain a 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\ would be a logical choice.

You can get more information on here:

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



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


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 architectures field in the same day, I have added some information on the topic to the Arduino Library Specification.